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) CreateAccounts(accounts bcommon.AccountMap) error
- func (s *State) Exist(addr common.Address) bool
- func (s *State) GetBalance(addr common.Address) *big.Int
- func (s *State) GetBlock(hash common.Hash) (*poset.Block, error)
- func (s *State) GetBlockById(id int64) (*poset.Block, error)
- func (s *State) GetBlockIndex() int64
- func (s *State) GetFailedTx(txHash common.Hash) (*TxError, error)
- 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
- func (s *State) PrintTransaction(tx *ethTypes.Transaction) string
- func (s *State) ProcessBlock(block poset.Block) (common.Hash, error)
- type TxError
- 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) 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) CreateAccounts ¶
func (s *State) CreateAccounts(accounts bcommon.AccountMap) error
func (*State) GetBlockIndex ¶
func (*State) GetPoolNonce ¶
GetPoolNonce returns an account's nonce from the txpool's ethState
func (*State) GetReceipt ¶
func (*State) GetTransaction ¶
func (*State) InitState ¶
InitState initializes the statedb object. It checks if there was already a root hash in the underlying database, in which case it initializes the statedb from that root.
func (*State) PrintTransaction ¶
func (s *State) PrintTransaction(tx *ethTypes.Transaction) string
type TxError ¶
type TxError struct { Tx ethTypes.Transaction `json:"tx"` Error string `json:"error"` }
func (*TxError) GetTx ¶
func (te *TxError) GetTx() *ethTypes.Transaction
type WriteAheadState ¶
type WriteAheadState struct {
// contains filtered or unexported fields
}
write ahead state, updated with each AppendTx and reset on Commit
func NewWriteAheadState ¶
func (*WriteAheadState) ApplyTransaction ¶
func (was *WriteAheadState) ApplyTransaction(tx ethTypes.Transaction, txIndex int, blockHash common.Hash) error