From 94ea9147c11a723abe078eff4b68507cf26483af Mon Sep 17 00:00:00 2001 From: NIC619 Date: Sun, 17 Dec 2017 20:28:47 +0900 Subject: [PATCH] fix error in updating a branch node to a leaf node --- trie_research/new_bintrie.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trie_research/new_bintrie.py b/trie_research/new_bintrie.py index 2f6db93..a438cad 100644 --- a/trie_research/new_bintrie.py +++ b/trie_research/new_bintrie.py @@ -182,7 +182,7 @@ def _update(db, node, keypath, val): if subnodetype == KV_TYPE: return hash_and_save(db, encode_kv_node(first_bit + subL, subR)) # kv node pointing to a branch node - elif subnodetype == BRANCH_TYPE: + elif subnodetype == BRANCH_TYPE or subnodetype == LEAF_TYPE: return hash_and_save(db, encode_kv_node(first_bit, newL or newR)) else: return hash_and_save(db, encode_branch_node(newL, newR))