Documentation
¶
Index ¶
- func AppendReceipts(tx kv.StatelessWriteTx, blockNumber uint64, receipts block.Receipts) error
- func CanonicalBlockByNumberWithSenders(db kv.Tx, number uint64) (*block.Block, []types.Address, error)
- func CanonicalTransactions(db kv.Getter, baseTxId uint64, amount uint32) ([]*transaction.Transaction, error)
- func CanonicalTxnByID(db kv.Getter, id uint64) (*transaction.Transaction, error)
- func DeleteDeposit(db kv.Deleter, addr types.Address) error
- func DeleteHeaderNumber(db kv.Deleter, hash types.Hash)
- func DeleteTxLookupEntry(db kv.Deleter, hash types.Hash) error
- func DepositNum(tx kv.Tx) (uint64, error)
- func FirstKey(tx kv.Tx, table string) ([]byte, error)
- func GetAccount(db kv.Tx, addr types.Address, acc *account.StateAccount) (bool, error)
- func GetAccountReward(db kv.Getter, account types.Address) (*uint256.Int, error)
- func GetDeposit(db kv.Getter, addr types.Address) (types.PublicKey, *uint256.Int, error)
- func GetPoaSnapshot(db kv.Getter, hash types.Hash) ([]byte, error)
- func HasBlock(db kv.Getter, hash types.Hash, number uint64) bool
- func HasHeader(db kv.Has, hash types.Hash, number uint64) bool
- func HasReceipts(db kv.Has, number uint64) bool
- func IsCanonicalHash(db kv.Getter, hash types.Hash) (bool, error)
- func IsDeposit(db kv.Getter, addr types.Address) bool
- func LastKey(tx kv.Tx, table string) ([]byte, error)
- func PruneTable(tx kv.RwTx, table string, pruneTo uint64, ctx context.Context, limit int) error
- func PruneTableDupSort(tx kv.RwTx, table string, logPrefix string, pruneTo uint64, ...) error
- func PutAccountReward(db kv.Putter, account types.Address, val *uint256.Int) error
- func PutDeposit(db kv.Putter, addr types.Address, pub types.PublicKey, amount uint256.Int) error
- func RawTransactionsRange(db kv.Getter, from, to uint64) (res [][]byte, err error)
- func ReadBlock(tx kv.Getter, hash types.Hash, number uint64) *block.Block
- func ReadBlockByHash(db kv.Tx, hash types.Hash) (*block.Block, error)
- func ReadBlockByNumber(db kv.Getter, number uint64) (*block.Block, error)
- func ReadBlockWithSenders(db kv.Getter, hash types.Hash, number uint64) (*block.Block, []types.Address, error)
- func ReadBody(db kv.Getter, hash types.Hash, number uint64) (*block.Body, uint64, uint32)
- func ReadBodyByNumber(db kv.Tx, number uint64) (*block.Body, uint64, uint32, error)
- func ReadBodyForStorageByKey(db kv.Getter, k []byte) (*block.BodyForStorage, error)
- func ReadBodyRAW(db kv.Tx, hash types.Hash, number uint64) []byte
- func ReadBodyWithTransactions(db kv.Getter, hash types.Hash, number uint64) (*block.Body, error)
- func ReadCanonicalBodyWithTransactions(db kv.Getter, hash types.Hash, number uint64) *block.Body
- func ReadCanonicalHash(db kv.Getter, number uint64) (types.Hash, error)
- func ReadChainConfig(db kv.Getter, hash types.Hash) (*params.ChainConfig, error)
- func ReadCurrentBlock(db kv.Tx) *block.Block
- func ReadCurrentBlockNumber(db kv.Getter) *uint64
- func ReadCurrentHeader(db kv.Getter) *block.Header
- func ReadHeadBlockHash(db kv.Getter) types.Hash
- func ReadHeadHeaderHash(db kv.Getter) types.Hash
- func ReadHeader(db kv.Getter, hash types.Hash, number uint64) *block.Header
- func ReadHeaderByHash(db kv.Getter, hash types.Hash) (*block.Header, error)
- func ReadHeaderByNumber(db kv.Getter, number uint64) *block.Header
- func ReadHeaderNumber(db kv.Getter, hash types.Hash) *uint64
- func ReadHeaderRAW(db kv.Getter, hash types.Hash, number uint64) []byte
- func ReadHeadersByNumber(db kv.Tx, number uint64) ([]*block.Header, error)
- func ReadRawReceipts(db kv.Tx, blockNum uint64) block.Receipts
- func ReadReceipt(db kv.Tx, txHash types.Hash) (*block.Receipt, types.Hash, uint64, uint64, error)
- func ReadReceipts(db kv.Tx, block *block.Block, senders []types.Address) block.Receipts
- func ReadReceiptsByHash(db kv.Tx, hash types.Hash) (block.Receipts, error)
- func ReadRewards(db kv.Getter, hash types.Hash, number uint64) ([]*block.Reward, error)
- func ReadSenders(db kv.Getter, hash types.Hash, number uint64) ([]types.Address, error)
- func ReadStorageBody(db kv.Getter, hash types.Hash, number uint64) (block.BodyForStorage, error)
- func ReadStorageBodyRAW(db kv.Getter, hash types.Hash, number uint64) []byte
- func ReadTd(db kv.Getter, hash types.Hash, number uint64) (*uint256.Int, error)
- func ReadTdByHash(db kv.Getter, hash types.Hash) (*uint256.Int, error)
- func ReadTransaction(db kv.Tx, hash types.Hash, blockNumber uint64) (*transaction.Transaction, types.Hash, uint64, uint64, error)
- func ReadTransactionByHash(db kv.Tx, hash types.Hash) (*transaction.Transaction, types.Hash, uint64, uint64, error)
- func ReadTxLookupEntry(db kv.Getter, txnHash types.Hash) (*uint64, error)
- func ReadVerifies(db kv.Getter, hash types.Hash, number uint64) ([]*block.Verify, error)
- func ReceiptsAvailableFrom(tx kv.Tx) (uint64, error)
- func SecondKey(tx kv.Tx, table string) ([]byte, error)
- func StorePoaSnapshot(db kv.Putter, hash types.Hash, data []byte) error
- func TruncateBlocks(ctx context.Context, tx kv.RwTx, blockFrom uint64) error
- func TruncateCanonicalHash(tx kv.RwTx, blockFrom uint64, deleteHeaders bool) error
- func TruncateReceipts(db kv.RwTx, number uint64) error
- func TruncateTd(tx kv.RwTx, blockFrom uint64) error
- func WriteBlock(db kv.RwTx, b *block.Block) error
- func WriteBody(db kv.RwTx, hash types.Hash, number uint64, body *block.Body) error
- func WriteBodyForStorage(db kv.Putter, hash types.Hash, number uint64, body *block.BodyForStorage) error
- func WriteCanonicalHash(db kv.Putter, hash types.Hash, number uint64) error
- func WriteChainConfig(db kv.RwTx, hash types.Hash, cfg *params.ChainConfig) error
- func WriteHeadBlockHash(db kv.Putter, hash types.Hash)
- func WriteHeadHeaderHash(db kv.Putter, hash types.Hash) error
- func WriteHeader(db kv.Putter, header *block.Header)
- func WriteHeaderNumber(db kv.Putter, hash types.Hash, number uint64) error
- func WriteRawBody(db kv.RwTx, hash types.Hash, number uint64, body *block.RawBody) (ok bool, lastTxnNum uint64, err error)
- func WriteRawBodyIfNotExists(db kv.RwTx, hash types.Hash, number uint64, body *block.RawBody) (ok bool, lastTxnNum uint64, err error)
- func WriteRawTransactions(tx kv.RwTx, txs [][]byte, baseTxId uint64) error
- func WriteReceipts(tx kv.Putter, number uint64, receipts block.Receipts) error
- func WriteRewards(db kv.Putter, hash types.Hash, number uint64, rewards []*block.Reward) error
- func WriteTd(db kv.Putter, hash types.Hash, number uint64, td *uint256.Int) error
- func WriteTransactions(db kv.RwTx, txs []*transaction.Transaction, baseTxId uint64) error
- func WriteTxLookupEntries(db kv.Putter, block *block.Block)
- func WriteVerifies(db kv.Putter, hash types.Hash, number uint64, verifies []*block.Verify) error
- type TxLookupEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendReceipts ¶
AppendReceipts stores all the transaction receipts belonging to a block.
func CanonicalTransactions ¶
func CanonicalTransactions(db kv.Getter, baseTxId uint64, amount uint32) ([]*transaction.Transaction, error)
func CanonicalTxnByID ¶
func CanonicalTxnByID(db kv.Getter, id uint64) (*transaction.Transaction, error)
func DeleteDeposit ¶
DeleteDeposit removes Deposit data associated with an address.
func DeleteHeaderNumber ¶
DeleteHeaderNumber removes hash->number mapping.
func DeleteTxLookupEntry ¶
DeleteTxLookupEntry removes all transaction data associated with a hash.
func GetAccount ¶
func GetAccountReward ¶
GetAccountReward
func GetDeposit ¶
GetDeposit
func HasBlock ¶
HasBlock - is more efficient than ReadBlock because doesn't read transactions. It's is not equivalent of HasHeader because headers and bodies written by different stages
func HasReceipts ¶
HasReceipts verifies the existence of all the transaction receipts belonging to a block.
func IsCanonicalHash ¶
IsCanonicalHash determines whether a header with the given hash is on the canonical chain.
func PruneTable ¶
PruneTable has `limit` parameter to avoid too large data deletes per one sync cycle - better delete by small portions to reduce db.FreeList size
func PruneTableDupSort ¶
func PutAccountReward ¶
PutAccountReward
func PutDeposit ¶
func RawTransactionsRange ¶
func ReadBlock ¶
ReadBlock retrieves an entire block corresponding to the hash, assembling it back from the stored header and body. If either the header or body could not be retrieved nil is returned.
Note, due to concurrent download of header and block body the header and thus canonical hash can be stored in the database but the body data not (yet).
func ReadBlockWithSenders ¶
func ReadBodyByNumber ¶
ReadBodyByNumber - returns canonical block body
func ReadBodyForStorageByKey ¶
func ReadBodyRAW ¶
ReadBodyRAW retrieves the block body (transactions and uncles) in encoding.
func ReadCanonicalHash ¶
ReadCanonicalHash retrieves the hash assigned to a canonical block number.
func ReadChainConfig ¶
ReadChainConfig retrieves the consensus settings based on the given genesis hash.
func ReadCurrentBlockNumber ¶
func ReadHeadBlockHash ¶
ReadHeadBlockHash retrieves the hash of the current canonical head block.
func ReadHeadHeaderHash ¶
ReadHeadHeaderHash retrieves the hash of the current canonical head header.
func ReadHeader ¶
ReadHeader retrieves the block header corresponding to the hash.
func ReadHeaderNumber ¶
ReadHeaderNumber returns the header number assigned to a hash.
func ReadHeaderRAW ¶
ReadHeaderRAW retrieves a block header in its raw database encoding.
func ReadHeadersByNumber ¶
func ReadRawReceipts ¶
ReadRawReceipts retrieves all the transaction receipts belonging to a block. The receipt metadata fields are not guaranteed to be populated, so they should not be used. Use ReadReceipts instead if the metadata is needed.
func ReadReceipt ¶
func ReadReceipts ¶
ReadReceipts retrieves all the transaction receipts belonging to a block, including its corresponding metadata fields. If it is unable to populate these metadata fields then nil is returned.
The current implementation populates these metadata fields by reading the receipts' corresponding block body, so if the block body is not found it will return nil even if the receipt itself is stored.
func ReadReceiptsByHash ¶
func ReadRewards ¶
func ReadSenders ¶
func ReadStorageBody ¶
func ReadStorageBodyRAW ¶
func ReadTransaction ¶
func ReadTransaction(db kv.Tx, hash types.Hash, blockNumber uint64) (*transaction.Transaction, types.Hash, uint64, uint64, error)
ReadTransaction retrieves a specific transaction from the database, along with its added positional metadata.
func ReadTransactionByHash ¶
func ReadTransactionByHash(db kv.Tx, hash types.Hash) (*transaction.Transaction, types.Hash, uint64, uint64, error)
ReadTransactionByHash retrieves a specific transaction from the database, along with its added positional metadata.
func ReadTxLookupEntry ¶
ReadTxLookupEntry retrieves the positional metadata associated with a transaction hash to allow retrieving the transaction or receipt by hash.
func ReadVerifies ¶
func TruncateBlocks ¶
TruncateBlocks - delete block >= blockFrom does decrement sequences of kv.EthTx and kv.NonCanonicalTxs doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty
func TruncateCanonicalHash ¶
TruncateCanonicalHash removes all the number to hash canonical mapping from block number N
func TruncateReceipts ¶
TruncateReceipts removes all receipt for given block number or newer
func TruncateTd ¶
TruncateTd removes all block total difficulty from block number N
func WriteBlock ¶
WriteBlock serializes a block into the database, header and body separately.
func WriteBodyForStorage ¶
func WriteBodyForStorage(db kv.Putter, hash types.Hash, number uint64, body *block.BodyForStorage) error
WriteBodyForStorage stores an encoded block body into the database.
func WriteCanonicalHash ¶
WriteCanonicalHash stores the hash assigned to a canonical block number.
func WriteChainConfig ¶
WriteChainConfig writes the chain config settings to the database.
func WriteHeadBlockHash ¶
WriteHeadBlockHash stores the head block's hash.
func WriteHeadHeaderHash ¶
WriteHeadHeaderHash stores the hash of the current canonical head header.
func WriteHeader ¶
WriteHeader stores a block header into the database and also stores the hash- to-number mapping.
func WriteHeaderNumber ¶
WriteHeaderNumber stores the hash->number mapping.
func WriteRawBody ¶
func WriteRawBodyIfNotExists ¶
func WriteRawTransactions ¶
func WriteReceipts ¶
WriteReceipts stores all the transaction receipts belonging to a block.
func WriteRewards ¶
func WriteTransactions ¶
func WriteTransactions(db kv.RwTx, txs []*transaction.Transaction, baseTxId uint64) error
func WriteTxLookupEntries ¶
WriteTxLookupEntries stores a positional metadata for every transaction from a block, enabling hash based transaction and receipt lookups.