core/state, trie, light: add a TryDeleteAccount method (#25531)

* core/state, trie, light: Add a DeleteAccount method

* review feedback

* Update database.go

* pr triage feedback

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
This commit is contained in:
Guillaume Ballet
2022-08-17 14:14:49 +03:00
committed by GitHub
co-authored by rjl493456442
parent 12185e40e0
commit 6da5c1644d
4 changed files with 19 additions and 1 deletions
+7
View File
@@ -189,6 +189,13 @@ func (t *StateTrie) TryDelete(key []byte) error {
return t.trie.TryDelete(hk)
}
// TryDeleteACcount abstracts an account deletion from the trie.
func (t *StateTrie) TryDeleteAccount(key []byte) error {
hk := t.hashKey(key)
delete(t.getSecKeyCache(), string(hk))
return t.trie.TryDelete(hk)
}
// GetKey returns the sha3 preimage of a hashed key that was
// previously used to store a value.
func (t *StateTrie) GetKey(shaKey []byte) []byte {