Skip to content

Commit

Permalink
Fixed bug: For extension node condition should use current path point…
Browse files Browse the repository at this point in the history
…er instead of updated path pointer
  • Loading branch information
Sarvesh Jain committed Feb 15, 2019
1 parent c48747a commit 97714b6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/lib/MerklePatriciaProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ library MerklePatriciaProof {
nodeKey = RLP.toBytes32(currentNodeList[nextPathNibble]);
pathPtr += 1;
} else if(currentNodeList.length == 2) {
uint currentpathPtr = pathPtr;
pathPtr += _nibblesToTraverse(RLP.toData(currentNodeList[0]), path, pathPtr);

if(pathPtr == path.length) {//leaf node
Expand All @@ -70,7 +71,7 @@ library MerklePatriciaProof {
}
}
//extension node ... test if means that it is empty value
if(_nibblesToTraverse(RLP.toData(currentNodeList[0]), path, pathPtr) == 0) {
if(_nibblesToTraverse(RLP.toData(currentNodeList[0]), path, currentpathPtr) == 0) {
return (keccak256(abi.encodePacked()) == value);
}

Expand Down

0 comments on commit 97714b6

Please sign in to comment.