mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +00:00
trie/bintrie: use correct key mapping in GetStorage and DeleteStorage
This commit is contained in:
parent
c9b7ae422c
commit
28397f4f25
1 changed files with 2 additions and 2 deletions
|
|
@ -236,7 +236,7 @@ func (t *BinaryTrie) GetAccount(addr common.Address) (*types.StateAccount, error
|
||||||
// not be modified by the caller. If a node was not found in the database, a
|
// not be modified by the caller. If a node was not found in the database, a
|
||||||
// trie.MissingNodeError is returned.
|
// trie.MissingNodeError is returned.
|
||||||
func (t *BinaryTrie) GetStorage(addr common.Address, key []byte) ([]byte, error) {
|
func (t *BinaryTrie) GetStorage(addr common.Address, key []byte) ([]byte, error) {
|
||||||
return t.root.Get(GetBinaryTreeKey(addr, key), t.nodeResolver)
|
return t.root.Get(GetBinaryTreeKeyStorageSlot(addr, key), t.nodeResolver)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateAccount updates the account information for the given address.
|
// UpdateAccount updates the account information for the given address.
|
||||||
|
|
@ -302,7 +302,7 @@ func (t *BinaryTrie) DeleteAccount(addr common.Address) error {
|
||||||
// DeleteStorage removes any existing value for key from the trie. If a node was not
|
// DeleteStorage removes any existing value for key from the trie. If a node was not
|
||||||
// found in the database, a trie.MissingNodeError is returned.
|
// found in the database, a trie.MissingNodeError is returned.
|
||||||
func (t *BinaryTrie) DeleteStorage(addr common.Address, key []byte) error {
|
func (t *BinaryTrie) DeleteStorage(addr common.Address, key []byte) error {
|
||||||
k := GetBinaryTreeKey(addr, key)
|
k := GetBinaryTreeKeyStorageSlot(addr, key)
|
||||||
var zero [HashSize]byte
|
var zero [HashSize]byte
|
||||||
root, err := t.root.Insert(k, zero[:], t.nodeResolver, 0)
|
root, err := t.root.Insert(k, zero[:], t.nodeResolver, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue