Documentation ¶
Index ¶
- func AllSegmentsDownloadComplete(tx kv.Getter) (allSegmentsDownloadComplete bool, err error)
- func AllSegmentsDownloadCompleteFromDB(db kv.RoDB) (allSegmentsDownloadComplete bool, err error)
- func AppendCanonicalTxNums(tx kv.RwTx, from uint64) (err error)
- func CanonicalTransactions(db kv.Getter, txnID uint64, amount uint32) ([]types.Transaction, error)
- func DeleteBody(db kv.Putter, hash common.Hash, number uint64)
- func DeleteHeader(db kv.Putter, hash common.Hash, number uint64)
- func DeleteNewerEpochs(tx kv.RwTx, number uint64) error
- func DeleteTxLookupEntry(db kv.Putter, hash libcommon.Hash) error
- func FindEpochBeforeOrEqualNumber(tx kv.Tx, n uint64) (blockNum uint64, blockHash common.Hash, transitionProof []byte, err error)
- func GetStateVersion(tx kv.Tx) (uint64, error)
- func HasBlock(db kv.Getter, hash common.Hash, number uint64) bool
- func HasBorReceipts(db kv.Getter, number uint64) bool
- func HasSenders(db kv.Getter, hash common.Hash, number uint64) (bool, error)
- func IncrementStateVersion(tx kv.RwTx) (uint64, error)
- func IsCanonicalHash(db kv.Getter, hash common.Hash, number uint64) (bool, error)
- func IsPosBlock(db kv.Getter, blockHash common.Hash) (trans bool, err error)
- func PruneBlocks(tx kv.RwTx, blockTo uint64, blocksDeleteLimit int) (deleted int, err 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 ReadBadHeaderNumber(db kv.Getter, hash common.Hash) (*uint64, error)
- func ReadBlock(tx kv.Getter, hash common.Hash, number uint64) *types.Block
- func ReadBlockWithSenders(db kv.Getter, hash common.Hash, number uint64) (*types.Block, []common.Address, error)
- func ReadBody(db kv.Getter, hash common.Hash, number uint64) (*types.Body, uint64, uint32)
- func ReadBodyForStorageByKey(db kv.Getter, k []byte) (*types.BodyForStorage, error)
- func ReadBodyRLP(db kv.Tx, hash common.Hash, number uint64) rlp.RawValue
- func ReadBodyWithTransactions(db kv.Getter, hash common.Hash, number uint64) (*types.Body, error)
- func ReadBorTransactionForBlock(db kv.Tx, blockNum uint64) types.Transaction
- func ReadBorTxLookupEntry(db kv.Getter, borTxHash libcommon.Hash) (*uint64, error)
- func ReadCanonicalHash(db kv.Getter, number uint64) (common.Hash, error)
- func ReadChainConfig(db kv.Getter, hash libcommon.Hash) (*chain.Config, error)
- func ReadCurrentBlockNumber(db kv.Getter) *uint64
- func ReadCurrentHeader(db kv.Getter) *types.Header
- func ReadCurrentHeaderHavingBody(db kv.Getter) *types.Header
- func ReadDBSchemaVersion(tx kv.Tx) (major, minor, patch uint32, ok bool, err error)
- func ReadEpoch(tx kv.Tx, blockNum uint64, blockHash common.Hash) (transitionProof []byte, err error)
- func ReadFirstNonGenesisHeaderNumber(tx kv.Tx) (uint64, bool, error)
- func ReadForkchoiceFinalized(db kv.Getter) common.Hash
- func ReadForkchoiceHead(db kv.Getter) common.Hash
- func ReadForkchoiceSafe(db kv.Getter) common.Hash
- func ReadGenesis(db kv.Getter) (*types.Genesis, error)
- func ReadHeadBlockHash(db kv.Getter) common.Hash
- func ReadHeadHeaderHash(db kv.Getter) common.Hash
- func ReadHeader(db kv.Getter, hash common.Hash, number uint64) *types.Header
- func ReadHeaderByHash(db kv.Getter, hash common.Hash) (*types.Header, error)
- func ReadHeaderByNumber(db kv.Getter, number uint64) *types.Header
- func ReadHeaderNumber(db kv.Getter, hash common.Hash) *uint64
- func ReadHeaderRLP(db kv.Getter, hash common.Hash, number uint64) rlp.RawValue
- func ReadHeadersByNumber(db kv.Tx, number uint64) (res []*types.Header, err error)
- func ReadLastNewBlockSeen(tx kv.Tx) (uint64, error)
- func ReadPendingEpoch(tx kv.Tx, blockNum uint64, blockHash common.Hash) (transitionProof []byte, err error)
- func ReadRawReceipts(db kv.Tx, blockNum uint64) types.Receipts
- func ReadReceipts(db kv.Tx, block *types.Block, senders []common.Address) types.Receipts
- func ReadSenders(db kv.Getter, hash common.Hash, number uint64) ([]common.Address, error)
- func ReadStorageBodyRLP(db kv.Getter, hash common.Hash, number uint64) rlp.RawValuedeprecated
- func ReadTd(db kv.Getter, hash common.Hash, number uint64) (*big.Int, error)
- func ReadTdByHash(db kv.Getter, hash common.Hash) (*big.Int, error)
- func ReadTxLookupEntry(db kv.Getter, txnHash libcommon.Hash) (*uint64, error)
- func ReadVerkleNode(tx kv.RwTx, root common.Hash) (verkle.VerkleNode, error)
- func ReadVerkleRoot(tx kv.Tx, blockNum uint64) (common.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 TruncateCanonicalChain(ctx context.Context, db kv.RwTx, from uint64) error
- func TruncateCanonicalHash(tx kv.RwTx, blockFrom uint64, markChainAsBad bool) error
- func TruncateReceipts(db kv.RwTx, number uint64) error
- func TruncateTd(tx kv.RwTx, blockFrom uint64) error
- func TxnByIdxInBlock(db kv.Getter, blockHash common.Hash, blockNum uint64, txIdxInBlock int) (types.Transaction, error)
- func WriteBlock(db kv.RwTx, block *types.Block) error
- func WriteBody(db kv.RwTx, hash common.Hash, number uint64, body *types.Body) (err error)
- func WriteBodyForStorage(db kv.Putter, hash common.Hash, number uint64, body *types.BodyForStorage) error
- func WriteCanonicalHash(db kv.Putter, hash common.Hash, number uint64) error
- func WriteChainConfig(db kv.Putter, hash libcommon.Hash, cfg *chain.Config) error
- func WriteDBSchemaVersion(tx kv.RwTx) error
- func WriteEpoch(tx kv.RwTx, blockNum uint64, blockHash common.Hash, transitionProof []byte) (err error)
- func WriteForkchoiceFinalized(db kv.Putter, hash common.Hash)
- func WriteForkchoiceHead(db kv.Putter, hash common.Hash)
- func WriteForkchoiceSafe(db kv.Putter, hash common.Hash)
- func WriteGenesisIfNotExist(db kv.RwTx, g *types.Genesis) error
- func WriteHeadBlockHash(db kv.Putter, hash common.Hash)
- func WriteHeadHeaderHash(db kv.Putter, hash common.Hash) error
- func WriteHeader(db kv.RwTx, header *types.Header) error
- func WriteHeaderNumber(db kv.Putter, hash common.Hash, number uint64) error
- func WriteHeaderRaw(db kv.StatelessRwTx, number uint64, hash common.Hash, headerRlp []byte, ...) error
- func WriteLastNewBlockSeen(tx kv.RwTx, blockNum uint64) error
- func WritePendingEpoch(tx kv.RwTx, blockNum uint64, blockHash common.Hash, transitionProof []byte) (err error)
- func WriteRawBody(db kv.RwTx, hash common.Hash, number uint64, body *types.RawBody) (ok bool, err error)
- func WriteRawBodyIfNotExists(db kv.RwTx, hash common.Hash, number uint64, body *types.RawBody) (ok bool, err error)
- func WriteRawTransactions(rwTx kv.RwTx, txs [][]byte, txnID uint64) error
- func WriteReceipts(tx kv.Putter, number uint64, receipts types.Receipts) error
- func WriteSenders(db kv.Putter, hash common.Hash, number uint64, senders []common.Address) error
- func WriteTd(db kv.Putter, hash common.Hash, number uint64, td *big.Int) error
- func WriteTransactions(rwTx kv.RwTx, txs []types.Transaction, txnID 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 common.Hash) error
- type TxLookupEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalTransactions ¶
func DeleteBody ¶
DeleteBody removes all block body data associated with a hash.
func DeleteHeader ¶
DeleteHeader - dangerous, use PruneBlocks/TruncateBlocks methods
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 ¶
HasBorReceipts verifies the existence of all block receipt belonging to a block.
func IsCanonicalHash ¶
func IsPosBlock ¶
IsPosBlock returns true if the block number comes after POS transition or is the last POW block
func PruneBlocks ¶
PruneBlocks - delete [1, to) old blocks after moving it to snapshots. keeps genesis in db: [1, to) doesn't change sequences of kv.EthTx doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty Returns false if there is nothing to prune
func PruneTable ¶
func PruneTable(tx kv.RwTx, table string, pruneTo uint64, ctx context.Context, limit int, timeout time.Duration) error
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 ReadBadHeaderNumber ¶
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 ReadBodyForStorageByKey ¶
func ReadBodyRLP ¶
ReadBodyRLP retrieves the block body (transactions and uncles) in RLP encoding.
func ReadBorTransactionForBlock ¶
func ReadBorTransactionForBlock(db kv.Tx, blockNum uint64) types.Transaction
ReadBorTransactionForBlock retrieves a specific bor (fake) transaction associated with a block, 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 ReadCurrentBlockNumber ¶
func ReadCurrentHeader ¶
ReadCurrentHeader reads the current canonical head header. It is updated in stage_headers, updateForkChoice. See: ReadHeadHeaderHash, ReadCurrentHeaderHavingBody
func ReadCurrentHeaderHavingBody ¶
ReadCurrentHeaderHavingBody reads the current canonical head header for which its block body is known. It is updated in stage_finish. See: ReadHeadBlockHash, ReadCurrentHeader
func ReadDBSchemaVersion ¶
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 header for which its block body is known. It is updated in stage_finish. See: kv.HeadBlockKey
func ReadHeadHeaderHash ¶
ReadHeadHeaderHash retrieves the hash of the current canonical head header. It is updated in stage_headers, updateForkChoice. See: ReadHeadBlockHash
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 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 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 ReadSenders ¶
func ReadTxLookupEntry ¶
ReadTxLookupEntry retrieves the positional metadata associated with a transaction hash to allow retrieving the transaction or receipt by hash.
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 doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty
func TruncateCanonicalChain ¶
func TruncateCanonicalHash ¶
TruncateCanonicalHash removes all the number to hash canonical mapping from block number N Mark chain as bad feature:
- BadBlock must be not available by hash
- but available by hash+num - if read num from kv.BadHeaderNumber table
- prune blocks: must delete Canonical/NonCanonical/BadBlocks also
func TruncateReceipts ¶
TruncateReceipts removes all receipt for given block number or newer - used for Unwind
func TruncateTd ¶
TruncateTd removes all block total difficulty from block number N
func TxnByIdxInBlock ¶
func WriteBlock ¶
WriteBlock serializes a block into the database, header and body separately.
func WriteBodyForStorage ¶
func WriteBodyForStorage(db kv.Putter, hash common.Hash, number uint64, body *types.BodyForStorage) error
WriteBodyForStorage stores an RLP 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 WriteDBSchemaVersion ¶
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 hash of the current canonical head header for which its block body is known. It is updated in stage_finish. See: kv.HeadBlockKey
func WriteHeadHeaderHash ¶
WriteHeadHeaderHash stores the hash of the current canonical head header. It is updated in stage_headers, updateForkChoice. See: WriteHeadBlockHash
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 WriteHeaderRaw ¶
func WritePendingEpoch ¶
func WriteRawBody ¶
func WriteRawBodyIfNotExists ¶
func WriteRawTransactions ¶
func WriteReceipts ¶
WriteReceipts stores all the transaction receipts belonging to a block.
func WriteSenders ¶
func WriteTransactions ¶
Write transactions to the database and use txnID as first identifier
func WriteTxLookupEntries ¶
WriteTxLookupEntries stores a positional metadata for every transaction from a block, enabling hash based transaction and receipt lookups.