Documentation ¶
Index ¶
- Variables
- func AppendReceipts(tx kv.StatelessWriteTx, blockNumber uint64, receipts types.Receipts) error
- func CanonicalBlockByNumberWithSenders(db kv.Tx, number uint64) (*types.Block, []libcommon.Address, error)
- func CanonicalTransactions(db kv.Getter, baseTxId uint64, amount uint32) ([]types.Transaction, error)
- func CanonicalTxnByID(db kv.Getter, id uint64, blockHash libcommon.Hash, transactionsV3 bool) (types.Transaction, error)
- func DeleteAncientBlocks(tx kv.RwTx, blockTo uint64, blocksDeleteLimit int) error
- func DeleteChainConfig(db kv.Deleter, hash libcommon.Hash) error
- func DeleteHeaderNumber(db kv.Deleter, hash libcommon.Hash)
- func DeleteNewerEpochs(tx kv.RwTx, number uint64) error
- func DeleteTransactions(db kv.RwTx, txsCount, baseTxId uint64, blockHash *libcommon.Hash) error
- func DeleteTxLookupEntry(db kv.Deleter, hash libcommon.Hash) error
- func FindEpochBeforeOrEqualNumber(tx kv.Tx, n uint64) (blockNum uint64, blockHash libcommon.Hash, transitionProof []byte, err error)
- func GetStateVersion(tx kv.Tx) (uint64, error)
- func HasBlock(db kv.Getter, hash libcommon.Hash, number uint64) bool
- func HasBorReceipts(db kv.Has, number uint64) bool
- func HasHeader(db kv.Has, hash libcommon.Hash, number uint64) bool
- func HasReceipts(db kv.Has, hash libcommon.Hash, number uint64) bool
- func IncrementStateVersion(tx kv.RwTx) (uint64, error)
- func IsCanonicalHash(db kv.Getter, hash libcommon.Hash) (bool, error)
- func IsPosBlock(db kv.Getter, blockHash libcommon.Hash) (trans bool, err error)
- func MakeBodiesCanonical(tx kv.RwTx, from uint64, ctx context.Context, logPrefix string, ...) error
- func MakeBodiesNonCanonical(tx kv.RwTx, from uint64, deleteBodies bool, ctx context.Context, ...) error
- func NonCanonicalBlockWithSenders(tx kv.Getter, hash libcommon.Hash, number uint64) (*types.Block, []libcommon.Address, error)
- func NonCanonicalBodyRLP(db kv.Tx, hash libcommon.Hash, number uint64) rlp.RawValue
- func NonCanonicalBodyWithTransactions(db kv.Getter, hash libcommon.Hash, number uint64) *types.Body
- func NonCanonicalTransactions(db kv.Getter, baseTxId uint64, amount uint32) ([]types.Transaction, 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 RawTransactionsRange(db kv.Getter, from, to uint64) (res [][]byte, err error)
- func ReadAccount(db kv.Tx, addr libcommon.Address, acc *accounts.Account) (bool, error)
- func ReadAncestor(db kv.Getter, hash libcommon.Hash, number, ancestor uint64, ...) (libcommon.Hash, uint64)
- func ReadBlock(tx kv.Getter, hash libcommon.Hash, number uint64) *types.Block
- func ReadBlockByHash(db kv.Tx, hash libcommon.Hash) (*types.Block, error)
- func ReadBlockByNumber(db kv.Tx, number uint64) (*types.Block, error)
- func ReadBlockWithSenders(db kv.Getter, hash libcommon.Hash, number uint64) (*types.Block, []libcommon.Address, error)
- func ReadBody(db kv.Getter, hash libcommon.Hash, number uint64) (*types.Body, uint64, uint32)
- func ReadBodyByNumber(db kv.Tx, number uint64) (*types.Body, uint64, uint32, error)
- func ReadBodyForStorageByKey(db kv.Getter, k []byte) (*types.BodyForStorage, error)
- func ReadBodyRLP(db kv.Tx, hash libcommon.Hash, number uint64) rlp.RawValue
- func ReadBodyWithTransactions(db kv.Getter, hash libcommon.Hash, number uint64) (*types.Body, error)
- func ReadBorReceipt(db kv.Tx, blockHash libcommon.Hash, blockNumber uint64, ...) (*types.Receipt, error)
- func ReadBorTransaction(db kv.Tx, borTxHash libcommon.Hash) (types.Transaction, libcommon.Hash, uint64, uint64, error)
- func ReadBorTransactionForBlock(db kv.Tx, block *types.Block) (types.Transaction, libcommon.Hash, uint64, uint64)
- func ReadBorTransactionForBlockNumber(db kv.Tx, blockNumber uint64) (types.Transaction, libcommon.Hash, uint64, uint64, error)
- func ReadBorTransactionForBlockNumberAndHash(db kv.Tx, blockNumber uint64, blockHash libcommon.Hash) (types.Transaction, libcommon.Hash, uint64, uint64, error)
- func ReadBorTxLookupEntry(db kv.Tx, borTxHash libcommon.Hash) (*uint64, error)
- func ReadCanonicalBodyWithTransactions(db kv.Getter, hash libcommon.Hash, number uint64) *types.Body
- func ReadCanonicalHash(db kv.Getter, number uint64) (libcommon.Hash, error)
- func ReadChainConfig(db kv.Getter, hash libcommon.Hash) (*chain.Config, error)
- func ReadCumulativeGasUsed(db kv.Getter, number uint64) (*big.Int, error)
- func ReadCurrentBlock(db kv.Tx) *types.Block
- func ReadCurrentBlockNumber(db kv.Getter) *uint64
- func ReadCurrentHeader(db kv.Getter) *types.Header
- func ReadEpoch(tx kv.Tx, blockNum uint64, blockHash libcommon.Hash) (transitionProof []byte, err error)
- func ReadForkchoiceFinalized(db kv.Getter) libcommon.Hash
- func ReadForkchoiceHead(db kv.Getter) libcommon.Hash
- func ReadForkchoiceSafe(db kv.Getter) libcommon.Hash
- func ReadHeadBlockHash(db kv.Getter) libcommon.Hash
- func ReadHeadHeaderHash(db kv.Getter) libcommon.Hash
- func ReadHeader(db kv.Getter, hash libcommon.Hash, number uint64) *types.Header
- func ReadHeaderByHash(db kv.Getter, hash libcommon.Hash) (*types.Header, error)
- func ReadHeaderByNumber(db kv.Getter, number uint64) *types.Header
- func ReadHeaderNumber(db kv.Getter, hash libcommon.Hash) *uint64
- func ReadHeaderRLP(db kv.Getter, hash libcommon.Hash, number uint64) rlp.RawValue
- func ReadHeadersByNumber(db kv.Tx, number uint64) ([]*types.Header, error)
- func ReadLastBlockSynced(db kv.Tx) (*types.Block, error)
- func ReadPendingEpoch(tx kv.Tx, blockNum uint64, blockHash libcommon.Hash) (transitionProof []byte, err error)
- func ReadRawBorReceipt(db kv.Tx, number uint64) (*types.Receipt, bool, error)
- func ReadRawReceipts(db kv.Tx, blockNum uint64) types.Receipts
- func ReadReceipt(db kv.Tx, txHash libcommon.Hash) (*types.Receipt, libcommon.Hash, uint64, uint64, error)
- func ReadReceipts(db kv.Tx, block *types.Block, senders []libcommon.Address) types.Receipts
- func ReadReceiptsByHash(db kv.Tx, hash libcommon.Hash) (types.Receipts, error)
- func ReadSenders(db kv.Getter, hash libcommon.Hash, number uint64) ([]libcommon.Address, error)
- func ReadSnapshots(tx kv.Tx) ([]string, []string, error)
- func ReadStorageBody(db kv.Getter, hash libcommon.Hash, number uint64) (types.BodyForStorage, error)
- func ReadStorageBodyRLP(db kv.Getter, hash libcommon.Hash, number uint64) rlp.RawValue
- func ReadTd(db kv.Getter, hash libcommon.Hash, number uint64) (*big.Int, error)
- func ReadTdByHash(db kv.Getter, hash libcommon.Hash) (*big.Int, error)
- func ReadTotalBurnt(db kv.Getter, number uint64) (*big.Int, error)
- func ReadTotalIssued(db kv.Getter, number uint64) (*big.Int, error)
- func ReadTransaction(db kv.Tx, hash libcommon.Hash, blockNumber uint64) (types.Transaction, libcommon.Hash, uint64, uint64, error)
- func ReadTransactionByHash(db kv.Tx, hash libcommon.Hash) (types.Transaction, libcommon.Hash, uint64, uint64, error)
- func ReadTxLookupEntry(db kv.Getter, txnHash libcommon.Hash) (*uint64, error)
- func ReadVerkleNode(tx kv.RwTx, root libcommon.Hash) (verkle.VerkleNode, error)
- func ReadVerkleRoot(tx kv.Tx, blockNum uint64) (libcommon.Hash, error)
- func ReceiptsAvailableFrom(tx kv.Tx) (uint64, error)
- func ResetSequence(tx kv.RwTx, bucket string, newValue uint64) error
- func Transitioned(db kv.Getter, blockNum uint64, terminalTotalDifficulty *big.Int) (trans bool, err error)
- func TruncateBlocks(ctx context.Context, tx kv.RwTx, blockFrom uint64) error
- func TruncateBodies(tx kv.RwTx, blockNum uint64) error
- func TruncateBorReceipts(db kv.RwTx, number 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, block *types.Block) error
- func WriteBody(db kv.RwTx, hash libcommon.Hash, number uint64, body *types.Body) error
- func WriteBodyForStorage(db kv.Putter, hash libcommon.Hash, number uint64, body *types.BodyForStorage) error
- func WriteBorReceipt(tx kv.RwTx, hash libcommon.Hash, number uint64, borReceipt *types.Receipt) error
- func WriteCanonicalHash(db kv.Putter, hash libcommon.Hash, number uint64) error
- func WriteChainConfig(db kv.Putter, hash libcommon.Hash, cfg *chain.Config) error
- func WriteCumulativeGasUsed(db kv.Putter, number uint64, cumulativeGasUsed *big.Int) error
- func WriteEpoch(tx kv.RwTx, blockNum uint64, blockHash libcommon.Hash, transitionProof []byte) (err error)
- func WriteForkchoiceFinalized(db kv.Putter, hash libcommon.Hash)
- func WriteForkchoiceHead(db kv.Putter, hash libcommon.Hash)
- func WriteForkchoiceSafe(db kv.Putter, hash libcommon.Hash)
- func WriteHeadBlockHash(db kv.Putter, hash libcommon.Hash)
- func WriteHeadHeaderHash(db kv.Putter, hash libcommon.Hash) error
- func WriteHeader(db kv.Putter, header *types.Header)
- func WriteHeaderNumber(db kv.Putter, hash libcommon.Hash, number uint64) error
- func WritePendingEpoch(tx kv.RwTx, blockNum uint64, blockHash libcommon.Hash, transitionProof []byte) (err error)
- func WriteRawBody(db kv.RwTx, hash libcommon.Hash, number uint64, body *types.RawBody) (ok bool, lastTxnID uint64, err error)
- func WriteRawBodyIfNotExists(db kv.RwTx, hash libcommon.Hash, number uint64, body *types.RawBody) (ok bool, lastTxnNum uint64, err error)
- func WriteRawTransactions(tx kv.RwTx, txs [][]byte, baseTxId uint64, blockHash *common2.Hash) error
- func WriteReceipts(tx kv.Putter, number uint64, receipts types.Receipts) error
- func WriteSenders(db kv.Putter, hash libcommon.Hash, number uint64, senders []libcommon.Address) error
- func WriteSnapshots(tx kv.RwTx, list, histList []string) error
- func WriteTd(db kv.Putter, hash libcommon.Hash, number uint64, td *big.Int) error
- func WriteTotalBurnt(db kv.Putter, number uint64, totalBurnt *big.Int) error
- func WriteTotalIssued(db kv.Putter, number uint64, totalIssued *big.Int) error
- func WriteTransactions(db kv.RwTx, txs []types.Transaction, baseTxId uint64, ...) error
- func WriteTxLookupEntries(db kv.Putter, block *types.Block)
- func WriteVerkleNode(tx kv.RwTx, node verkle.VerkleNode) error
- func WriteVerkleRoot(tx kv.RwTx, blockNum uint64, root libcommon.Hash) error
- type TxLookupEntry
Constants ¶
This section is empty.
Variables ¶
var SnapshotsHistoryKey = []byte("snapshots_history")
var SnapshotsKey = []byte("snapshots")
Functions ¶
func AppendReceipts ¶
AppendReceipts stores all the transaction receipts belonging to a block.
func CanonicalTransactions ¶
func CanonicalTxnByID ¶
func DeleteAncientBlocks ¶
DeleteAncientBlocks - delete [1, to) old blocks after moving it to snapshots. keeps genesis in db: [1, to) doesn't change sequences of kv.EthTx and kv.NonCanonicalTxs doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty
func DeleteChainConfig ¶
DeleteChainConfig retrieves the consensus settings based on the given genesis hash.
func DeleteHeaderNumber ¶
DeleteHeaderNumber removes hash->number mapping.
func DeleteTransactions ¶
func DeleteTxLookupEntry ¶
DeleteTxLookupEntry removes all transaction data associated with a hash.
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 HasBorReceipts ¶
HasBorReceipt verifies the existence of all block receipt belonging to a block.
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 IsPosBlock ¶
IsPosBlock returns true if the block number comes after POS transition or is the last POW block
func MakeBodiesCanonical ¶
func MakeBodiesCanonical(tx kv.RwTx, from uint64, ctx context.Context, logPrefix string, logEvery *time.Ticker, transactionsV3 bool, cb func(blockNum, lastTxnNum uint64) error) error
MakeBodiesCanonical - move all txs of non-canonical blocks from NonCanonicalTxs table to EthTx table
func MakeBodiesNonCanonical ¶
func MakeBodiesNonCanonical(tx kv.RwTx, from uint64, deleteBodies bool, ctx context.Context, logPrefix string, logEvery *time.Ticker) error
MakeBodiesNonCanonical - move all txs of canonical blocks to NonCanonicalTxs bucket
func NonCanonicalBodyRLP ¶
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 RawTransactionsRange ¶
func ReadAccount ¶
func ReadAncestor ¶
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 ReadBodyRLP ¶
ReadBodyRLP retrieves the block body (transactions and uncles) in RLP encoding.
func ReadBorReceipt ¶
func ReadBorTransaction ¶
func ReadBorTransaction(db kv.Tx, borTxHash libcommon.Hash) (types.Transaction, libcommon.Hash, uint64, uint64, error)
ReadBorTransaction returns a specific bor (fake) transaction by txn hash, along with its added positional metadata.
func ReadBorTransactionForBlock ¶
func ReadBorTransactionForBlock(db kv.Tx, block *types.Block) (types.Transaction, libcommon.Hash, uint64, uint64)
ReadBorTransactionForBlock retrieves a specific bor (fake) transaction associated with a block, along with its added positional metadata.
func ReadBorTransactionForBlockNumber ¶
func ReadBorTransactionForBlockNumber(db kv.Tx, blockNumber uint64) (types.Transaction, libcommon.Hash, uint64, uint64, error)
ReadBorTransactionForBlockNumber returns a bor (fake) transaction by block number, along with its added positional metadata.
func ReadBorTransactionForBlockNumberAndHash ¶
func ReadBorTransactionForBlockNumberAndHash(db kv.Tx, blockNumber uint64, blockHash libcommon.Hash) (types.Transaction, libcommon.Hash, uint64, uint64, error)
ReadBorTransactionForBlockNumberAndHash returns a bor (fake) transaction by block number and block hash, along with its added positional metadata.
func ReadBorTxLookupEntry ¶
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 ReadCumulativeGasUsed ¶
func ReadCurrentBlockNumber ¶
func ReadForkchoiceFinalized ¶
ReadForkchoiceFinalized retrieves finalizedBlockHash from the last Engine API forkChoiceUpdated.
func ReadForkchoiceHead ¶
ReadForkchoiceHead retrieves headBlockHash from the last Engine API forkChoiceUpdated.
func ReadForkchoiceSafe ¶
ReadForkchoiceSafe retrieves safeBlockHash from the last Engine API forkChoiceUpdated.
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 ReadHeaderByHash ¶
func ReadHeaderNumber ¶
ReadHeaderNumber returns the header number assigned to a hash.
func ReadHeaderRLP ¶
ReadHeaderRLP retrieves a block header in its raw RLP database encoding.
func ReadHeadersByNumber ¶
func ReadPendingEpoch ¶
func ReadRawBorReceipt ¶
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 ReadSenders ¶
func ReadStorageBody ¶
func ReadStorageBodyRLP ¶
func ReadTransaction ¶
func ReadTransaction(db kv.Tx, hash libcommon.Hash, blockNumber uint64) (types.Transaction, libcommon.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 libcommon.Hash) (types.Transaction, libcommon.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 ReadVerkleNode ¶
func ResetSequence ¶
ResetSequence - allow set arbitrary value to sequence (for example to decrement it to exact value)
func Transitioned ¶
func Transitioned(db kv.Getter, blockNum uint64, terminalTotalDifficulty *big.Int) (trans bool, err error)
Transitioned returns true if the block number comes after POS transition or is the last POW block
func TruncateBlocks ¶
TruncateBlocks - delete block >= blockFrom does decrement sequences of kv.EthTx and kv.NonCanonicalTxs doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty
func TruncateBorReceipts ¶
TruncateBorReceipts removes all bor receipt for given block number or newer
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 libcommon.Hash, number uint64, body *types.BodyForStorage) error
WriteBodyForStorage stores an RLP encoded block body into the database.
func WriteBorReceipt ¶
func WriteBorReceipt(tx kv.RwTx, hash libcommon.Hash, number uint64, borReceipt *types.Receipt) error
WriteBorReceipt stores all the bor receipt belonging to a block (storing the state sync recipt and log).
func WriteCanonicalHash ¶
WriteCanonicalHash stores the hash assigned to a canonical block number.
func WriteChainConfig ¶
WriteChainConfig writes the chain config settings to the database.
func WriteCumulativeGasUsed ¶
func WriteEpoch ¶
func WriteForkchoiceFinalized ¶
WriteForkchoiceFinalized stores finalizedBlockHash from the last Engine API forkChoiceUpdated.
func WriteForkchoiceHead ¶
WriteForkchoiceHead stores headBlockHash from the last Engine API forkChoiceUpdated.
func WriteForkchoiceSafe ¶
WriteForkchoiceSafe stores safeBlockHash from the last Engine API forkChoiceUpdated.
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 WritePendingEpoch ¶
func WriteRawBody ¶
func WriteRawBodyIfNotExists ¶
func WriteRawTransactions ¶
func WriteReceipts ¶
WriteReceipts stores all the transaction receipts belonging to a block.
func WriteSenders ¶
func WriteTotalIssued ¶
func WriteTransactions ¶
func WriteTxLookupEntries ¶
WriteTxLookupEntries stores a positional metadata for every transaction from a block, enabling hash based transaction and receipt lookups.