mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
This commit is contained in:
parent
c91a67c4c0
commit
bf893cb73b
1 changed files with 4 additions and 3 deletions
|
|
@ -323,15 +323,16 @@ func (db *Database) insert(hash common.Hash, size int, node node) {
|
|||
db.dirtiesSize += common.StorageSize(common.HashLength + entry.size)
|
||||
}
|
||||
|
||||
// InsertPreimage writes a new trie Node pre-image to the memory database if it's
|
||||
// yet unknown. The method will make a copy of the slice.
|
||||
// insertPreimage writes a new trie node pre-image to the memory database if it's
|
||||
// yet unknown. The method will NOT make a copy of the slice,
|
||||
// only use if the preimage will NOT be changed later on.
|
||||
//
|
||||
// Note, this method assumes that the database's Lock is held!
|
||||
func (db *Database) InsertPreimage(hash common.Hash, preimage []byte) {
|
||||
if _, ok := db.preimages[hash]; ok {
|
||||
return
|
||||
}
|
||||
db.preimages[hash] = common.CopyBytes(preimage)
|
||||
db.preimages[hash] = preimage
|
||||
db.preimagesSize += common.StorageSize(common.HashLength + len(preimage))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue