Documentation ¶
Index ¶
- Variables
- type DatabaseDeleter
- type DatabasePutter
- type DatabaseReader
- type State
- func (s *State) ApplyTransaction(txBytes []byte, txIndex int, blockHash common.Hash) error
- func (s *State) Call(callMsg ethTypes.Message) ([]byte, error)
- func (s *State) CheckTx(tx *ethTypes.Transaction) error
- func (s *State) Commit() (common.Hash, error)
- func (s *State) CreateGenesisAccounts() error
- func (s *State) Empty(addr common.Address) bool
- func (s *State) GetBalance(addr common.Address) *big.Int
- func (s *State) GetNonce(addr common.Address) uint64
- func (s *State) GetPoolNonce(addr common.Address) uint64
- func (s *State) GetReceipt(txHash common.Hash) (*ethTypes.Receipt, error)
- func (s *State) GetTransaction(hash common.Hash) (*ethTypes.Transaction, error)
- func (s *State) InitState() error
- type TxPool
- type WriteAheadState
Constants ¶
This section is empty.
Variables ¶
var (
MIPMapLevels = []uint64{1000000, 500000, 100000, 50000, 1000}
)
Functions ¶
This section is empty.
Types ¶
type DatabaseDeleter ¶
DatabaseDeleter wraps the Delete method of a backing data store.
type DatabasePutter ¶
DatabasePutter wraps the Put method of a backing data store.
type DatabaseReader ¶
DatabaseReader wraps the Get method of a backing data store.
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) ApplyTransaction ¶
ApplyTransaction decodes a transaction and applies it to the WAS. It is meant to be called by the consensus system to apply transactions sequentially.
func (*State) Call ¶
Call executes a readonly transaction on the statedb. It is called by the service handlers
func (*State) CheckTx ¶
func (s *State) CheckTx(tx *ethTypes.Transaction) error
CheckTx attempt to apply a transaction to the TxPool's statedb. It is called by the Service handlers to check if a transaction is valid before submitting it to the consensus system. This also updates the sender's Nonce in the TxPool's statedb.
func (*State) Commit ¶
Commit persists all pending state changes (in the WAS) to the DB, and resets the WAS and TxPool
func (*State) CreateGenesisAccounts ¶
func (*State) GetBalance ¶
GetBalance returns an account's balance from the main ethState
func (*State) GetPoolNonce ¶
GetPoolNonce returns an account's nonce from the txpool's ethState
func (*State) GetReceipt ¶
GetReceipt fetches transaction receipts by transaction hash directly from the DB
func (*State) GetTransaction ¶
GetTransaction fetches transactions by hash directly from the DB.
type WriteAheadState ¶
type WriteAheadState struct {
// contains filtered or unexported fields
}
WriteAheadState is a wrapper around a DB and StateDB object that applies transactions to the StateDB and only commits them to the DB upon Commit. It also handles persisting transactions, logs, and receipts to the DB. NOT THREAD SAFE
func NewWriteAheadState ¶
func (*WriteAheadState) ApplyTransaction ¶
func (was *WriteAheadState) ApplyTransaction(tx ethTypes.Transaction, txIndex int, blockHash common.Hash) error