txdb

txdb stores specific transaction data in all blocks, event and error after the transaction is executed.

Interface

Code is here
The following are the interfaces of the core functions. Developers can customize their own txdb if required.

func GetTxn(txnHash Hash) (*SignedTxn, error)
func SetTxn(stxn *SignedTxn) error

GetTxn(txnHash) gets transaction data based on the hash value of the transaction
SetTxn(stxn) stores transaction data in the txdb (indexed by transaction hash))

func GetTxns(blockHash Hash) ([]*SignedTxn, error)
func SetTxns(blockHash Hash, txns []*SignedTxn) error

GetTxns(blockHash) gets all transaction data in the block according to the block hash
SetTxns(blockHash, txns) stores all transaction data in a block into txdb(Indexed by transaction hash)

func GetEvents(blockHash Hash) ([]*Event, error)
func SetEvents(events []*Event) error

GetEvents(blockHash) gets all events in the block according to the block hash
SetEvents(events) stores all event in txdb (indexed by auto-incrementing ID)

func GetErrors(blockHash Hash) ([]*Error, error)
func SetError(err *Error) error

GetErrors(blockHash) gets all error in the block according to the block hash
SetError(err) stores all error in txdb (indexed by auto-incrementing ID)