diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-01-20 22:06:28 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-01-20 22:06:28 +0800 |
commit | f3d4ce0d164f7b17a143304e2b94421573d596a4 (patch) | |
tree | 9c4dab5e403b3c71cc1a95c59b23cf8bba1bc0ba /trie/secure_trie.go | |
parent | 886478b18b73bbe8421531f1a71664a2bc0f5eeb (diff) | |
download | dexon-f3d4ce0d164f7b17a143304e2b94421573d596a4.tar dexon-f3d4ce0d164f7b17a143304e2b94421573d596a4.tar.gz dexon-f3d4ce0d164f7b17a143304e2b94421573d596a4.tar.bz2 dexon-f3d4ce0d164f7b17a143304e2b94421573d596a4.tar.lz dexon-f3d4ce0d164f7b17a143304e2b94421573d596a4.tar.xz dexon-f3d4ce0d164f7b17a143304e2b94421573d596a4.tar.zst dexon-f3d4ce0d164f7b17a143304e2b94421573d596a4.zip |
core/state, ethdb, trie: test intermediate secure key leak, fix memdb bug
Diffstat (limited to 'trie/secure_trie.go')
-rw-r--r-- | trie/secure_trie.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/trie/secure_trie.go b/trie/secure_trie.go index ca515aacb..be7defe83 100644 --- a/trie/secure_trie.go +++ b/trie/secure_trie.go @@ -109,7 +109,7 @@ func (t *SecureTrie) TryUpdate(key, value []byte) error { if err != nil { return err } - t.secKeyCache[string(hk)] = key + t.secKeyCache[string(hk)] = common.CopyBytes(key) return nil } @@ -123,7 +123,9 @@ func (t *SecureTrie) Delete(key []byte) { // TryDelete removes any existing value for key from the trie. // If a node was not found in the database, a MissingNodeError is returned. func (t *SecureTrie) TryDelete(key []byte) error { - return t.Trie.TryDelete(t.hashKey(key)) + hk := t.hashKey(key) + delete(t.secKeyCache, string(hk)) + return t.Trie.TryDelete(hk) } // GetKey returns the sha3 preimage of a hashed key that was |