From ee78e8037b761f8da79d73aca196d4d2e9524564 Mon Sep 17 00:00:00 2001 From: qinglin89 <316032931@qq.com> Date: Thu, 12 Jan 2023 11:51:58 +0800 Subject: [PATCH] trie: reduce fullNode to valueNode with only index[16] after delete --- trie/trie.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trie/trie.go b/trie/trie.go index 1a456b8cfd..353342d197 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -472,7 +472,9 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) { } } if pos >= 0 { - if pos != 16 { + if pos == 16 { + return true, n.Children[16].(valueNode), nil + } else { // If the remaining entry is a short node, it replaces // n and its key gets the missing nibble tacked to the // front. This avoids creating an invalid