diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 58d72f32baa04ff626bab5362815ebda9dfbae8a..f23aa5775b4e68b4b36fdeff8da2e971c7db880d 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -272,13 +272,13 @@ func ImportPreimages(db *ethdb.LDBDatabase, fn string) error { // Accumulate the preimages and flush when enough ws gathered preimages[crypto.Keccak256Hash(blob)] = common.CopyBytes(blob) if len(preimages) > 1024 { - rawdb.WritePreimages(db, 0, preimages) + rawdb.WritePreimages(db, preimages) preimages = make(map[common.Hash][]byte) } } // Flush the last batch preimage data if len(preimages) > 0 { - rawdb.WritePreimages(db, 0, preimages) + rawdb.WritePreimages(db, preimages) } return nil } diff --git a/core/blockchain.go b/core/blockchain.go index f4a818f4c05419fd54868ceb70c82b2924745dc3..1b0c26ae255bab16ee32ec324a8a99f32a04bf94 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1002,7 +1002,7 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types. } // Write the positional metadata for transaction/receipt lookups and preimages rawdb.WriteTxLookupEntries(batch, block) - rawdb.WritePreimages(batch, block.NumberU64(), state.Preimages()) + rawdb.WritePreimages(batch, state.Preimages()) status = CanonStatTy } else { diff --git a/core/rawdb/accessors_metadata.go b/core/rawdb/accessors_metadata.go index 514328e87b7e2532f5fb1f0c66692a8c069b4668..3b6e6548d381b5b184c44c2b8fe46eafdb603aff 100644 --- a/core/rawdb/accessors_metadata.go +++ b/core/rawdb/accessors_metadata.go @@ -77,9 +77,8 @@ func ReadPreimage(db DatabaseReader, hash common.Hash) []byte { return data } -// WritePreimages writes the provided set of preimages to the database. `number` is the -// current block number, and is used for debug messages only. -func WritePreimages(db DatabaseWriter, number uint64, preimages map[common.Hash][]byte) { +// WritePreimages writes the provided set of preimages to the database. +func WritePreimages(db DatabaseWriter, preimages map[common.Hash][]byte) { for hash, preimage := range preimages { if err := db.Put(preimageKey(hash), preimage); err != nil { log.Crit("Failed to store trie preimage", "err", err) diff --git a/core/rawdb/schema.go b/core/rawdb/schema.go index ef597ef309f6faaa5ba7c269d07ef13b5575a247..8a9921ef40d2ba11e04f7ec0fcda20bb7d702b74 100644 --- a/core/rawdb/schema.go +++ b/core/rawdb/schema.go @@ -35,7 +35,7 @@ var ( // headBlockKey tracks the latest know full block's hash. headBlockKey = []byte("LastBlock") - // headFastBlockKey tracks the latest known incomplete block's hash duirng fast sync. + // headFastBlockKey tracks the latest known incomplete block's hash during fast sync. headFastBlockKey = []byte("LastFast") // fastTrieProgressKey tracks the number of trie entries imported during fast sync.