les: historical data garbage collection (#19570)
This change introduces garbage collection for the light client. Historical chain data is deleted periodically. If you want to disable the GC, use the --light.nopruning flag.
This commit is contained in:
@ -82,7 +82,6 @@ func StorageTrieID(state *TrieID, addrHash, root common.Hash) *TrieID {
|
||||
|
||||
// TrieRequest is the ODR request type for state/storage trie entries
|
||||
type TrieRequest struct {
|
||||
OdrRequest
|
||||
Id *TrieID
|
||||
Key []byte
|
||||
Proof *NodeSet
|
||||
@ -95,7 +94,6 @@ func (req *TrieRequest) StoreResult(db ethdb.Database) {
|
||||
|
||||
// CodeRequest is the ODR request type for retrieving contract code
|
||||
type CodeRequest struct {
|
||||
OdrRequest
|
||||
Id *TrieID // references storage trie of the account
|
||||
Hash common.Hash
|
||||
Data []byte
|
||||
@ -108,9 +106,9 @@ func (req *CodeRequest) StoreResult(db ethdb.Database) {
|
||||
|
||||
// BlockRequest is the ODR request type for retrieving block bodies
|
||||
type BlockRequest struct {
|
||||
OdrRequest
|
||||
Hash common.Hash
|
||||
Number uint64
|
||||
Header *types.Header
|
||||
Rlp []byte
|
||||
}
|
||||
|
||||
@ -119,9 +117,8 @@ func (req *BlockRequest) StoreResult(db ethdb.Database) {
|
||||
rawdb.WriteBodyRLP(db, req.Hash, req.Number, req.Rlp)
|
||||
}
|
||||
|
||||
// ReceiptsRequest is the ODR request type for retrieving block bodies
|
||||
// ReceiptsRequest is the ODR request type for retrieving receipts.
|
||||
type ReceiptsRequest struct {
|
||||
OdrRequest
|
||||
Untrusted bool // Indicator whether the result retrieved is trusted or not
|
||||
Hash common.Hash
|
||||
Number uint64
|
||||
@ -138,7 +135,6 @@ func (req *ReceiptsRequest) StoreResult(db ethdb.Database) {
|
||||
|
||||
// ChtRequest is the ODR request type for state/storage trie entries
|
||||
type ChtRequest struct {
|
||||
OdrRequest
|
||||
Untrusted bool // Indicator whether the result retrieved is trusted or not
|
||||
PeerId string // The specified peer id from which to retrieve data.
|
||||
Config *IndexerConfig
|
||||
@ -193,7 +189,6 @@ type TxStatus struct {
|
||||
|
||||
// TxStatusRequest is the ODR request type for retrieving transaction status
|
||||
type TxStatusRequest struct {
|
||||
OdrRequest
|
||||
Hashes []common.Hash
|
||||
Status []TxStatus
|
||||
}
|
||||
|
Reference in New Issue
Block a user