verifiers

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 14 Imported by: 0

README

This package is intended to provide a stateless and standalone execution of a complete and partly verifications of a chain block and all types of chain transactions. It might be extended soon into a utility that can create and sign all types of transactions.

Exposed API

  • CheckBlock
  • CheckTx

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBlock

func CheckBlock(db database.DB, prevBlock block.Block, blk block.Block) error

CheckBlock will verify whether a block is valid according to the rules of the consensus returns nil if a block is valid

func CheckBlockCertificate

func CheckBlockCertificate(committee committee.Foldable, blk block.Block) error

CheckBlockCertificate ensures that the block certificate is valid.

func CheckBlockHeader

func CheckBlockHeader(prevBlock block.Block, blk block.Block) error

CheckBlockHeader checks whether a block header is malformed, These are stateless and stateful checks returns nil, if all checks pass

func CheckMultiCoinbases

func CheckMultiCoinbases(txs []transactions.Transaction) error

CheckMultiCoinbases returns an error if there is more than one coinbase transaction

in the list or if there are none

func CheckSpecialFields

func CheckSpecialFields(txIndex uint64, blockTime uint64, tx transactions.Transaction) error

CheckSpecialFields TBD

func CheckStandardTx

func CheckStandardTx(db database.DB, tx transactions.Standard) error

CheckStandardTx checks whether the standard fields are correct against the passed blockchain db. These checks are both stateless and stateful.

func CheckTx

func CheckTx(db database.DB, index uint64, blockTime uint64, tx transactions.Transaction) error

CheckTx will verify whether a transaction is valid by checking: - It has not been double spent - It is not malformed Index indicates the position that the transaction is in, in a block If it is a solo transaction, this is set to 0 blockTime indicates what time the transaction will be included in a block If it is a solo transaction, the blockTime is calculated by using currentBlockTime+consensusSeconds Returns nil if a tx is valid

func VerifyBid

func VerifyBid(index uint64, blockTime uint64, tx *transactions.Bid) error

func VerifyCoinbase

func VerifyCoinbase(txIndex uint64, tx *transactions.Coinbase) error

func VerifyStake

func VerifyStake(index uint64, blockTime uint64, tx *transactions.Stake) error

func VerifyStandard

func VerifyStandard(tx *transactions.Standard) error

func VerifyTimelock

func VerifyTimelock(index uint64, blockTime uint64, tx *transactions.TimeLock) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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