aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSheldon <11510383@mail.sustc.edu.cn>2018-11-26 20:27:49 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-11-26 20:27:49 +0800
commitca228569e4aedd5ebbe853ec61761561d86579a6 (patch)
treefc89ec0c91b82e774469f8cf715d394376332331
parentf5e6634fd2fd2be5520c77edb7a5cd375eb28fd4 (diff)
downloaddexon-ca228569e4aedd5ebbe853ec61761561d86579a6.tar.gz
dexon-ca228569e4aedd5ebbe853ec61761561d86579a6.tar.zst
dexon-ca228569e4aedd5ebbe853ec61761561d86579a6.zip
light: odrTrie tryUpdate should use update (#18107)
TryUpdate does not call t.trie.TryUpdate(key, value) and calls t.trie.TryDelete instead. The update operation simply deletes the corresponding entry, though it could retrieve later by odr. However, it adds further network overhead.
-rw-r--r--light/trie.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/light/trie.go b/light/trie.go
index c07e99461..ab4e18b43 100644
--- a/light/trie.go
+++ b/light/trie.go
@@ -108,7 +108,7 @@ func (t *odrTrie) TryGet(key []byte) ([]byte, error) {
func (t *odrTrie) TryUpdate(key, value []byte) error {
key = crypto.Keccak256(key)
return t.do(key, func() error {
- return t.trie.TryDelete(key)
+ return t.trie.TryUpdate(key, value)
})
}