From ca228569e4aedd5ebbe853ec61761561d86579a6 Mon Sep 17 00:00:00 2001 From: Sheldon <11510383@mail.sustc.edu.cn> Date: Mon, 26 Nov 2018 20:27:49 +0800 Subject: [PATCH] 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. --- light/trie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) }) }