verifier

package
v1.0.1-txapi Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2018 License: GPL-3.0 Imports: 18 Imported by: 8

Documentation

Index

Constants

View Source
const (
	TimeOutHeight = uint64(24 * 30 * 3600)
)

Variables

View Source
var (
	ErrVerifyAccountAddrFailed             = errors.New("account address doesn't exist, need receiveTx for more balance first")
	ErrVerifyHashFailed                    = errors.New("verify hash failed")
	ErrVerifySignatureFailed               = errors.New("verify signature failed")
	ErrVerifyNonceFailed                   = errors.New("check pow nonce failed")
	ErrVerifySnapshotOfReferredBlockFailed = errors.New("verify snapshotBlock of the referredBlock failed")
	ErrVerifyForVmGeneratorFailed          = errors.New("generator in verifier failed")
	ErrVerifyWithVmResultFailed            = errors.New("verify with vm result failed")
)

Functions

This section is empty.

Types

type AccountBlockVerifyStat

type AccountBlockVerifyStat struct {
	// contains filtered or unexported fields
}

func (*AccountBlockVerifyStat) ErrMsg

func (result *AccountBlockVerifyStat) ErrMsg() string

func (*AccountBlockVerifyStat) GetPendingTasks

func (result *AccountBlockVerifyStat) GetPendingTasks() ([]*AccountPendingTask, *SnapshotPendingTask)

func (*AccountBlockVerifyStat) VerifyResult

func (result *AccountBlockVerifyStat) VerifyResult() VerifyResult

type AccountHashH

type AccountHashH struct {
	Addr   *types.Address
	Hash   *types.Hash
	Height *big.Int
}

type AccountPendingTask

type AccountPendingTask struct {
	Addr *types.Address
	Hash *types.Hash
}

type AccountReader

type AccountReader interface {
	GetLatestAccountBlock(addr *types.Address) (*ledger.AccountBlock, error)
	GetAccountBlockByHash(blockHash *types.Hash) (*ledger.AccountBlock, error)
	GetContractGid(addr *types.Address) (*types.Gid, error)
	AccountType(address *types.Address) (uint64, error)
	GetAccount(address *types.Address) (*ledger.Account, error)
	GetConfirmAccountBlock(snapshotHeight uint64, address *types.Address) (*ledger.AccountBlock, error)
	GetStateTrie(hash *types.Hash) *trie.Trie
	NewStateTrie() *trie.Trie
}

type AccountVerifier

type AccountVerifier struct {
	// contains filtered or unexported fields
}

func NewAccountVerifier

func NewAccountVerifier(chain Chain, consensus Consensus) *AccountVerifier

func (*AccountVerifier) VerifyDataValidity

func (verifier *AccountVerifier) VerifyDataValidity(block *ledger.AccountBlock) error

func (*AccountVerifier) VerifyHash

func (verifier *AccountVerifier) VerifyHash(block *ledger.AccountBlock) error

func (*AccountVerifier) VerifyIsReceivedSucceed

func (verifier *AccountVerifier) VerifyIsReceivedSucceed(block *ledger.AccountBlock) bool

func (*AccountVerifier) VerifyNetAb

func (verifier *AccountVerifier) VerifyNetAb(block *ledger.AccountBlock) error

func (*AccountVerifier) VerifyNonce

func (verifier *AccountVerifier) VerifyNonce(block *ledger.AccountBlock, accountType uint64) error

func (*AccountVerifier) VerifyP2PDataValidity

func (verifier *AccountVerifier) VerifyP2PDataValidity(block *ledger.AccountBlock) error

func (*AccountVerifier) VerifyReferred

func (verifier *AccountVerifier) VerifyReferred(block *ledger.AccountBlock) (VerifyResult, *AccountBlockVerifyStat)

contractAddr's sendBlock don't call VerifyReferredforPool

func (*AccountVerifier) VerifySigature

func (verifier *AccountVerifier) VerifySigature(block *ledger.AccountBlock) error

func (*AccountVerifier) VerifySnapshotOfReferredBlock

func (verifier *AccountVerifier) VerifySnapshotOfReferredBlock(thisBlock *ledger.AccountBlock, referredBlock *ledger.AccountBlock) (VerifyResult, error)

func (*AccountVerifier) VerifyTimeNotYet

func (verifier *AccountVerifier) VerifyTimeNotYet(block *ledger.AccountBlock) error

func (*AccountVerifier) VerifyTimeOut

func (verifier *AccountVerifier) VerifyTimeOut(blockReferSb *ledger.SnapshotBlock) error

func (*AccountVerifier) VerifyforRPC

func (verifier *AccountVerifier) VerifyforRPC(block *ledger.AccountBlock) (blocks []*vm_context.VmAccountBlock, err error)

func (*AccountVerifier) VerifyforVM

func (verifier *AccountVerifier) VerifyforVM(block *ledger.AccountBlock) (blocks []*vm_context.VmAccountBlock, err error)

type Chain

type Chain interface {
	AccountReader
	SnapshotReader
	OnRoad
}

type Consensus

type Consensus interface {
	VerifyAccountProducer(block *ledger.AccountBlock) (bool, error)
}

type NetVerifier

type NetVerifier interface {
	VerifyNetSb(block *ledger.SnapshotBlock) error
	VerifyNetAb(block *ledger.AccountBlock) error
}

func NewNetVerifier

func NewNetVerifier(sv *SnapshotVerifier, av *AccountVerifier) NetVerifier

type OnRoad

type OnRoad interface {
	IsSuccessReceived(addr *types.Address, hash *types.Hash) bool
}

type SnapshotBlockVerifyStat

type SnapshotBlockVerifyStat struct {
	// contains filtered or unexported fields
}

func (*SnapshotBlockVerifyStat) ErrMsg

func (self *SnapshotBlockVerifyStat) ErrMsg() string

func (*SnapshotBlockVerifyStat) Results

func (self *SnapshotBlockVerifyStat) Results() map[types.Address]VerifyResult

func (*SnapshotBlockVerifyStat) VerifyResult

func (self *SnapshotBlockVerifyStat) VerifyResult() VerifyResult

type SnapshotPendingTask

type SnapshotPendingTask struct {
	Hash *types.Hash
}

type SnapshotReader

type SnapshotReader interface {
	GetSnapshotBlockByHash(hash *types.Hash) (*ledger.SnapshotBlock, error)
	GetConfirmBlock(accountBlockHash *types.Hash) (*ledger.SnapshotBlock, error)
	GetConfirmTimes(accountBlockHash *types.Hash) (uint64, error)
	GetLatestSnapshotBlock() *ledger.SnapshotBlock
	GetSnapshotBlockByHeight(height uint64) (*ledger.SnapshotBlock, error)
	GetSnapshotBlocksByHeight(height uint64, count uint64, forward, containSnapshotContent bool) ([]*ledger.SnapshotBlock, error)
	GetGenesisSnapshotBlock() *ledger.SnapshotBlock
	GetSnapshotBlockBeforeTime(timestamp *time.Time) (*ledger.SnapshotBlock, error)
}

type SnapshotVerifier

type SnapshotVerifier struct {
	// contains filtered or unexported fields
}

func NewSnapshotVerifier

func NewSnapshotVerifier(ch chain.Chain, cs consensus.Verifier) *SnapshotVerifier

func (*SnapshotVerifier) VerifyAccountTimeout

func (self *SnapshotVerifier) VerifyAccountTimeout(addr types.Address, snapshotHeight uint64) error

func (*SnapshotVerifier) VerifyNetSb

func (self *SnapshotVerifier) VerifyNetSb(block *ledger.SnapshotBlock) error

func (*SnapshotVerifier) VerifyReferred

func (self *SnapshotVerifier) VerifyReferred(block *ledger.SnapshotBlock) *SnapshotBlockVerifyStat

func (*SnapshotVerifier) VerifyTimeout

func (self *SnapshotVerifier) VerifyTimeout(nowHeight uint64, referHeight uint64) bool

type VerifyResult

type VerifyResult int
const (
	FAIL VerifyResult = iota
	PENDING
	SUCCESS
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL