Skip to content

Commit

Permalink
light: odrTrie tryUpdate should use update (#18107)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Sheldon authored and fjl committed Nov 26, 2018
1 parent f5e6634 commit ca22856
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion light/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down

0 comments on commit ca22856

Please sign in to comment.