core

package
v0.0.0-...-dd5a67f Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// incorrect block's number (current_block_number + 1 != insert_block's_number)
	ErrWrongBlockNumber = errors.New("incorrect block number")

	ErrWrongParentHash = errors.New("block's parent hash does not match with current block")

	ErrTooHighHash = errors.New("block's hash is higher than difficulty")

	ErrWrongInterlink = errors.New("wrong interlink")
)
View Source
var (
	// ErrKnownBlock is returned when a block to import is already known locally.
	ErrKnownBlock = errors.New("block already known")

	// ErrNonceTooHigh is returned if the nonce of a transaction is higher than the
	// next one expected based on the local chain.
	ErrNonceTooHigh = errors.New("nonce too high")
)
View Source
var (
	// ErrInvalidSender is returned if the transaction contains an invalid signature.
	ErrInvalidSender = errors.New("invalid sender")

	// Prev nonce + 1 != Post nonce
	ErrIncorrectNonce = errors.New("incorrect nonce")

	// Prev/Post balance sum is different
	ErrIncorrectBalance = errors.New("incorrect balance")

	// Incorrect Prev state
	ErrIncorrectPrevState = errors.New("incorrect prev state")
)

Reference : tx_pool.go#L43

Functions

func ApplyTransaction

func ApplyTransaction(tx *types.Transaction)

Types

type BlockChain

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

func NewBlockChain

func NewBlockChain(db xordb.Database) *BlockChain

func NewBlockChainForBitcoin

func NewBlockChainForBitcoin(db xordb.Database) (*BlockChain, *ecdsa.PrivateKey)

func NewIoTBlockChain

func NewIoTBlockChain(db xordb.Database, genesis *types.Block) *BlockChain

func (*BlockChain) ApplyTransaction

func (bc *BlockChain) ApplyTransaction(tx *types.Transaction)

Apply transaction to state and save tx (for bitcoin data transform)

func (*BlockChain) BlockAt

func (bc *BlockChain) BlockAt(index uint64) *types.Block

func (*BlockChain) CurrentBlock

func (bc *BlockChain) CurrentBlock() *types.Block

func (*BlockChain) Genesis

func (bc *BlockChain) Genesis() *types.Block

func (*BlockChain) GetDB

func (bc *BlockChain) GetDB() xordb.Database

func (*BlockChain) Insert

func (bc *BlockChain) Insert(block *types.Block) error

check block's validity, if ok, then insert block into chain

func (*BlockChain) InsertForBitcoin

func (bc *BlockChain) InsertForBitcoin(block *types.Block) error

check block's validity, if ok, then insert block into chain

func (*BlockChain) PrintBlockChain

func (bc *BlockChain) PrintBlockChain()

type BlockValidator

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

func (*BlockValidator) ValidateBody

func (v *BlockValidator) ValidateBody(block *types.Block) error

func (*BlockValidator) ValidateState

func (v *BlockValidator) ValidateState(block *types.Block) error

type Genesis

type Genesis struct {
}

func DefaultGenesisBlock

func DefaultGenesisBlock() *Genesis

type StateProcessor

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

func (*StateProcessor) Process

func (p *StateProcessor) Process(block *types.Block, state *state.Accounts)

type TxPool

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

Reference : tx_pool.go#L205

func NewTxPool

func NewTxPool(chain *BlockChain) *TxPool

func (*TxPool) Add

func (pool *TxPool) Add(tx *types.Transaction) (bool, error)

func (*TxPool) Chain

func (pool *TxPool) Chain() *BlockChain

func (*TxPool) DequeueTx

func (pool *TxPool) DequeueTx() (*types.Transaction, bool)

func (*TxPool) Len

func (pool *TxPool) Len() int

Directories

Path Synopsis
Package rawdb contains a collection of low level database accessors.
Package rawdb contains a collection of low level database accessors.

Jump to

Keyboard shortcuts

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