Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion solidity/contracts/BTCUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,11 @@ library BTCUtils {
// i moves in increments of 32
for (uint i = 0; i < _tree.length; i += 32) {
if (_idx % 2 == 1) {
_current = _hash256MerkleStep(_tree.slice32(i), _current);
bytes32 _left = _tree.slice32(i);
if (_left == _current) {
return false;
}
_current = _hash256MerkleStep(_left, _current);
} else {
_current = _hash256MerkleStep(_current, _tree.slice32(i));
}
Expand Down
14 changes: 14 additions & 0 deletions testVectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,20 @@
"index": 0
},
"output": false
},
{
"input": {
"proof": "0x0D02210B9177CFC8193B95254473FF7BD986ED1179C276D12BAD5BDBA2403AD40D02210B9177CFC8193B95254473FF7BD986ED1179C276D12BAD5BDBA2403AD4D467A41E18243ABAB48B946D4E235092F87C3F1E1E2B87BC06D3BE1F29E13DCEF94B61259C7E9AF3455B277275800D0D6A58B929EEDF9E0153A6EF2278A5D534",
"index": 2
},
"output": true
},
{
"input": {
"proof": "0x0D02210B9177CFC8193B95254473FF7BD986ED1179C276D12BAD5BDBA2403AD40D02210B9177CFC8193B95254473FF7BD986ED1179C276D12BAD5BDBA2403AD4D467A41E18243ABAB48B946D4E235092F87C3F1E1E2B87BC06D3BE1F29E13DCEF94B61259C7E9AF3455B277275800D0D6A58B929EEDF9E0153A6EF2278A5D534",
"index": 3
},
"output": false
}
],
"getErrBadLength": [
Expand Down