Documentation ¶
Index ¶
- Constants
- Variables
- type BlockResult
- type Blockchain
- func (b *Blockchain) CalculateGasLimit(number uint64) (uint64, error)
- func (b *Blockchain) ChainDB() ethdb.Database
- func (b *Blockchain) Close() error
- func (b *Blockchain) Config() *chain.Chain
- func (b *Blockchain) CurrentTD() *big.Int
- func (b *Blockchain) GetBlockByNumber(blockNumber uint64, full bool) (*types.Block, bool)
- func (b *Blockchain) GetBodyByHash(hash types.Hash) (*types.Body, bool)
- func (b *Blockchain) GetHashHelper(header *types.Header) func(i uint64) (res types.Hash)
- func (b *Blockchain) GetHeaderByHash(hash types.Hash) (*types.Header, bool)
- func (b *Blockchain) GetHeaderByNumber(n uint64) (*types.Header, bool)
- func (b *Blockchain) GetReceiptsByHash(hash types.Hash) ([]*types.Receipt, error)
- func (b *Blockchain) GetTD(hash types.Hash) (*big.Int, bool)
- func (b *Blockchain) HandleGenesis() error
- func (b *Blockchain) Header() *types.Header
- func (b *Blockchain) IsSystemTransaction(height uint64, coinbase types.Address, tx *types.Transaction) bool
- func (b *Blockchain) SelfCheck()
- func (b *Blockchain) SubscribeEvents() Subscription
- func (b *Blockchain) VerifyFinalizedBlock(block *types.Block) error
- func (b *Blockchain) VerifyHeader(header *types.Header) error
- func (b *Blockchain) WriteBlock(block *types.Block) error
- func (b *Blockchain) WriteHeader(header *types.Header) error
- type Event
- type EventType
- type Executor
- type IBlockchain
- type MockSubscription
- type Subscription
Constants ¶
View Source
const BlockGasTargetDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations
Variables ¶
View Source
var ( ErrNoBlock = errors.New("no block data passed in") ErrNoBlockHeader = errors.New("no block header data passed in") ErrParentNotFound = errors.New("parent block not found") ErrInvalidParentHash = errors.New("parent block hash is invalid") ErrParentHashMismatch = errors.New("invalid parent block hash") ErrInvalidBlockSequence = errors.New("invalid block sequence") ErrInvalidSha3Uncles = errors.New("invalid block sha3 uncles root") ErrInvalidTxRoot = errors.New("invalid block transactions root") ErrInvalidReceiptsSize = errors.New("invalid number of receipts") ErrInvalidStateRoot = errors.New("invalid block state root") ErrInvalidGasUsed = errors.New("invalid block gas used") ErrInvalidReceiptsRoot = errors.New("invalid block receipts root") ErrNilStorageBuilder = errors.New("nil storage builder") ErrClosed = errors.New("blockchain is closed") ErrExistBlock = errors.New("exist block") )
Functions ¶
This section is empty.
Types ¶
type BlockResult ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
func NewBlockchain ¶
func (*Blockchain) CalculateGasLimit ¶
func (b *Blockchain) CalculateGasLimit(number uint64) (uint64, error)
CalculateGasLimit returns the gas limit of the next block after parent
func (*Blockchain) ChainDB ¶
func (b *Blockchain) ChainDB() ethdb.Database
func (*Blockchain) Close ¶
func (b *Blockchain) Close() error
func (*Blockchain) Config ¶
func (b *Blockchain) Config() *chain.Chain
func (*Blockchain) CurrentTD ¶
func (b *Blockchain) CurrentTD() *big.Int
func (*Blockchain) GetBlockByNumber ¶
func (*Blockchain) GetBodyByHash ¶
func (*Blockchain) GetHashHelper ¶
GetHashHelper is used by the EVM, so that the SC can get the hash of the header number
func (*Blockchain) GetHeaderByHash ¶
func (*Blockchain) GetHeaderByNumber ¶
func (b *Blockchain) GetHeaderByNumber(n uint64) (*types.Header, bool)
func (*Blockchain) GetReceiptsByHash ¶
get receitps by block header hash
func (*Blockchain) HandleGenesis ¶
func (b *Blockchain) HandleGenesis() error
func (*Blockchain) Header ¶
func (b *Blockchain) Header() *types.Header
func (*Blockchain) IsSystemTransaction ¶
func (b *Blockchain) IsSystemTransaction(height uint64, coinbase types.Address, tx *types.Transaction) bool
func (*Blockchain) SelfCheck ¶
func (b *Blockchain) SelfCheck()
func (*Blockchain) SubscribeEvents ¶
func (b *Blockchain) SubscribeEvents() Subscription
SubscribeEvents returns a blockchain event subscription
func (*Blockchain) VerifyFinalizedBlock ¶
func (b *Blockchain) VerifyFinalizedBlock(block *types.Block) error
func (*Blockchain) VerifyHeader ¶
func (b *Blockchain) VerifyHeader(header *types.Header) error
func (*Blockchain) WriteBlock ¶
func (b *Blockchain) WriteBlock(block *types.Block) error
func (*Blockchain) WriteHeader ¶
func (b *Blockchain) WriteHeader(header *types.Header) error
type Event ¶
type Event struct { // Old chain (removed headers) if there was a reorg OldChain []*types.Header // New part of the chain (or a fork) NewChain []*types.Header // Difficulty is the new difficulty created with this event Difficulty *big.Int // Type is the type of event Type EventType // Source is the source that generated the blocks for the event // right now it can be either the Sealer or the Syncer Source string }
Event is the blockchain event that gets passed to the listeners
func (*Event) AddNewHeader ¶
AddNewHeader appends a header to the event's NewChain array
func (*Event) AddOldHeader ¶
AddOldHeader appends a header to the event's OldChain array
func (*Event) SetDifficulty ¶
SetDifficulty sets the event difficulty
type Executor ¶
type Executor interface { BeginTxn(parentRoot types.Hash, header *types.Header, coinbase types.Address) (*state.Transition, error) //nolint:lll ProcessTransactions(transition *state.Transition, gasLimit uint64, transactions []*types.Transaction) (*state.Transition, error) Stop() }
type IBlockchain ¶
type MockSubscription ¶
type MockSubscription struct {
// contains filtered or unexported fields
}
func NewMockSubscription ¶
func NewMockSubscription() *MockSubscription
func (*MockSubscription) Close ¶
func (m *MockSubscription) Close()
func (*MockSubscription) GetEvent ¶
func (m *MockSubscription) GetEvent() *Event
func (*MockSubscription) GetEventCh ¶
func (m *MockSubscription) GetEventCh() chan *Event
func (*MockSubscription) Push ¶
func (m *MockSubscription) Push(e *Event)
type Subscription ¶
Subscription is the blockchain subscription interface
Click to show internal directories.
Click to hide internal directories.