Permalink
Browse files

assert that merkle_root passed to get_share is correct

  • Loading branch information...
forrestv committed Jan 1, 2013
1 parent 2dffea0 commit bfc7337ceed42cc261a1dc3aa9258e0aa99178fe
Showing with 4 additions and 2 deletions.
  1. +4 −2 p2pool/data.py
View
@@ -199,15 +199,17 @@ def generate_transaction(cls, tracker, share_data, block_target, desired_timesta
)
def get_share(header, last_txout_nonce=last_txout_nonce):
- min_header=dict(header);del min_header['merkle_root']
- return cls(net, None, dict(
+ min_header = dict(header); del min_header['merkle_root']
+ share = cls(net, None, dict(
min_header=min_header,
share_info=share_info,
ref_merkle_link=dict(branch=[], index=0),
last_txout_nonce=last_txout_nonce,
hash_link=prefix_to_hash_link(bitcoin_data.tx_type.pack(gentx)[:-32-4-4], cls.gentx_before_refhash),
merkle_link=bitcoin_data.calculate_merkle_link([None] + other_transaction_hashes, 0),
))
+ assert share.header == header # checks merkle_root
+ return share
return share_info, gentx, other_transaction_hashes, get_share

0 comments on commit bfc7337

Please sign in to comment.