Documentation ¶
Index ¶
- Variables
- type BalanceValidator
- func (v *BalanceValidator) MaxTxPerBlock() uint32
- func (v *BalanceValidator) ValidateBlock(block *pb.Block, s state.Reader) error
- func (v *BalanceValidator) ValidateTransactions(transactions []*pb.Transaction, s state.Reader) error
- func (v *BalanceValidator) ValidateTx(tx *pb.Transaction, s state.Reader) error
- type GossipValidator
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyTx is returned when the transaction is nil. ErrEmptyTx = errors.New("tx is empty") // ErrInvalidTxValue is returned when the transaction value is 0. ErrInvalidTxValue = errors.New("invalid tx value") // ErrInvalidTxSender is returned when the transaction sender is invalid. ErrInvalidTxSender = errors.New("invalid tx sender") // ErrInvalidTxRecipient is returned when the transaction recipient is invalid. ErrInvalidTxRecipient = errors.New("invalid tx recipient") // ErrMissingTxSignature is returned when the transaction signature is missing. ErrMissingTxSignature = errors.New("missing tx signature") // ErrInvalidTxSignature is returned when the transaction signature is invalid. ErrInvalidTxSignature = errors.New("invalid tx signature") // ErrTxSignatureNotHandled is returned when the transaction signature scheme isn't implemented. ErrTxSignatureNotHandled = errors.New("tx signature scheme not supported yet") // ErrTooManyTxs is returned when the sender tries to put too many transactions in a block. ErrTooManyTxs = errors.New("too many txs in proposed block") // ErrInvalidMerkleRoot is returned when the merkle root doesn't represent the block transactions. ErrInvalidMerkleRoot = errors.New("invalid merkle root") // ErrMultipleMinerRewards is returned when a block contains multiple miner rewards. ErrMultipleMinerRewards = errors.New("only one miner reward transaction is allowed per block") // ErrInvalidMinerReward is returned when the miner reward is invalid. ErrInvalidMinerReward = errors.New("miner reward is invalid") // ErrBlockHeightZero is returned we receive a block with height 0. ErrBlockHeightZero = errors.New("block should have height higher than 0") )
Functions ¶
This section is empty.
Types ¶
type BalanceValidator ¶
type BalanceValidator struct {
// contains filtered or unexported fields
}
BalanceValidator validates coin transactions. It verifies that transactions are well-formed and signed, and that users don't spend more coins than they have.
func (*BalanceValidator) MaxTxPerBlock ¶
func (v *BalanceValidator) MaxTxPerBlock() uint32
MaxTxPerBlock returns the maximum number of transactions allowed in a block.
func (*BalanceValidator) ValidateBlock ¶
ValidateBlock validates a block.
func (*BalanceValidator) ValidateTransactions ¶
func (v *BalanceValidator) ValidateTransactions(transactions []*pb.Transaction, s state.Reader) error
ValidateTransactions validates the transactions contained in a block.
func (*BalanceValidator) ValidateTx ¶
func (v *BalanceValidator) ValidateTx(tx *pb.Transaction, s state.Reader) error
ValidateTx validates a transaction. If state is nil, ValidateTx only validates that the transaction is well-formed and properly signed.
type GossipValidator ¶
type GossipValidator struct { *BalanceValidator // contains filtered or unexported fields }
GossipValidator validates everything including the block header except balances.
func (*GossipValidator) ValidateBlock ¶
ValidateBlock validates the transactions contained in a block and the block header.
func (*GossipValidator) ValidateTransactions ¶
func (g *GossipValidator) ValidateTransactions(transactions []*pb.Transaction, state state.Reader) error
ValidateTransactions validates that transactions are well-formed and properly signed.
func (*GossipValidator) ValidateTx ¶
func (g *GossipValidator) ValidateTx(tx *pb.Transaction, state state.Reader) error
ValidateTx validates that the transaction is well-formed and properly signed.
type Validator ¶
type Validator interface { // MaxTxPerBlock returns the maximum number of transactions // allowed in a block. MaxTxPerBlock() uint32 // ValidateTx validates a transaction. // If state is nil, ValidateTx only validates that the // transaction is well-formed and properly signed. ValidateTx(tx *pb.Transaction, state state.Reader) error // ValidateBlock validates the contents of a block. ValidateBlock(block *pb.Block, state state.Reader) error // ValidateTransactions validates a list of transactions. ValidateTransactions(transactions []*pb.Transaction, state state.Reader) error }
Validator is an interface which defines the standard for block and transaction validation. It is only responsible for validating the block contents, as the header validation is done by the specific consensus engines.
func NewBalanceValidator ¶
NewBalanceValidator creates a BalanceValidator.
Directories ¶
Path | Synopsis |
---|---|
Package mockvalidator is a generated GoMock package.
|
Package mockvalidator is a generated GoMock package. |