Merge pull request #76 from NIC619/fix_bin_trie_update_child_leaf_node

Fix bin trie update child leaf node
This commit is contained in:
NIC Lin 2017-12-23 00:31:17 +09:00 committed by GitHub
commit ccdadfd1b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))