Closed ethers closed 9 years ago
this exact issue is fixed with https://github.com/vbuterin/pybitcointools/commit/189fc6628aa8a795d04fa4b8fbfefc3e9bdae207
(but found another bug which will be opened next)
189fc66 probably caused #74
Keeping this seems clearer
if len(nodes) % 2:
newnodes.append(bin_sha256(bin_sha256(nodes[-1] + nodes[-1])))
So instead of
merkle_siblings = \
[layers[i][(index >> i) ^ 1] for i in range(len(layers)-1)]
something like this fixes issue #73
merkle_siblings = []
for i in range(len(layers)-1):
j = (index >> i) ^ 1
if j == len(layers[i]):
j -= 1
merkle_siblings.append(layers[i][j])
What do you think?
https://github.com/vbuterin/pybitcointools/blob/master/bitcoin/blocks.py#L43 is hitting index out of range
fda... is the 8th indexed transaction of block 100001