fix error in updating a branch node to a leaf node

This commit is contained in:
NIC619 2017-12-17 20:28:47 +09:00
parent e122673051
commit 94ea9147c1
1 changed files with 1 additions and 1 deletions

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