verifier

package
v0.0.0-...-96daba7 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVerifyForVMGeneratorFailed = errors.New("generator in verifier failed")

	ErrVerifyAccountTypeNotSure      = errors.New("general account's sendBlock.Height must be larger than 1")
	ErrVerifyConfirmedTimesNotEnough = errors.New("verify referred confirmedTimes not enough")

	ErrVerifyHashFailed           = errors.New("verify hash failed")
	ErrVerifySignatureFailed      = errors.New("verify signature failed")
	ErrVerifyNonceFailed          = errors.New("check pow nonce failed")
	ErrVerifyPrevBlockFailed      = errors.New("verify prevBlock failed, incorrect use of prevHash or fork happened")
	ErrVerifyRPCBlockPendingState = errors.New("verify referred block failed, pending for them")
)

Errors that the external module needs to be aware of.

Functions

This section is empty.

Types

type AccBlockPendingTask

type AccBlockPendingTask struct {
	AccountTask []*AccountPendingTask
}

AccBlockPendingTask defines a data structure for a pending transaction

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
}

AccountPendingTask defines to carry the information of those account block to be processed(PENDING).

type AccountVerifier

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

AccountVerifier implements all method to verify the transaction.

func NewAccountVerifier

func NewAccountVerifier(chain accountChain, consensus consensus) *AccountVerifier

NewAccountVerifier needs two args, the implementation methods of the "accountChain" and "consensus"

func (*AccountVerifier) InitOnRoadPool

func (v *AccountVerifier) InitOnRoadPool(manager *onroad.Manager)

InitOnRoadPool method implements the inspection on whether the Contract's onRoad block is at the lowest height.

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
}

SnapshotPendingTask defines to carry the information of those snapshot block to be processed(PENDING).

type SnapshotVerifier

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

func NewSnapshotVerifier

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

func (*SnapshotVerifier) VerifyNetSb

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

func (*SnapshotVerifier) VerifyReferred

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

type Verifier

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

	VerifyRPCAccBlock(block *ledger.AccountBlock, snapshot *ledger.SnapshotBlock) (*vm_db.VmAccountBlock, error)
	VerifyPoolAccBlock(block *ledger.AccountBlock, snapshot *ledger.SnapshotBlock) (*AccBlockPendingTask, *vm_db.VmAccountBlock, error)

	VerifyAccBlockNonce(block *ledger.AccountBlock) error
	VerifyAccBlockHash(block *ledger.AccountBlock) error
	VerifyAccBlockSignature(block *ledger.AccountBlock) error
	VerifyAccBlockProducerLegality(block *ledger.AccountBlock) error

	GetSnapshotVerifier() *SnapshotVerifier

	InitOnRoadPool(manager *onroad.Manager)
}

Verifier provides methods that external modules can use.

func NewVerifier

func NewVerifier(sv *SnapshotVerifier, av *AccountVerifier) Verifier

NewVerifier needs instances of SnapshotVerifier and AccountVerifier.

type VerifyResult

type VerifyResult int

VerifyResult explains the states of transaction validation.

const (
	PENDING VerifyResult = iota
	FAIL
	SUCCESS
)

PENDING represents the block which can't be determined because its dependent transactions were not verified, FAIL represents the block which is found illegal or unqualified, SUCCESS represents the block is successfully verified.

Jump to

Keyboard shortcuts

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