Permalink
Browse files

renamed other_transaction_hashes to desired_other_transaction_hashes

  • Loading branch information...
forrestv committed Oct 3, 2012
1 parent 42ef991 commit 025c265ebdd3531135d5e5efc76566e0ec84b93f
Showing with 6 additions and 6 deletions.
  1. +5 −5 p2pool/data.py
  2. +1 −1 p2pool/work.py
View
@@ -113,7 +113,7 @@ class Share(object):
gentx_before_refhash = pack.VarStrType().pack(DONATION_SCRIPT) + pack.IntType(64).pack(0) + pack.VarStrType().pack('\x20' + pack.IntType(256).pack(0))[:2]
@classmethod
- def generate_transaction(cls, tracker, share_data, block_target, desired_timestamp, desired_target, ref_merkle_link, other_transaction_hashes, net):
+ def generate_transaction(cls, tracker, share_data, block_target, desired_timestamp, desired_target, ref_merkle_link, desired_other_transaction_hashes, net):
previous_share = tracker.items[share_data['previous_share_hash']] if share_data['previous_share_hash'] is not None else None
height, last = tracker.get_height_and_last(share_data['previous_share_hash'])
@@ -170,17 +170,17 @@ def generate_transaction(cls, tracker, share_data, block_target, desired_timesta
)
def get_share(header, transactions):
- assert transactions[0] == gentx and [bitcoin_data.hash256(bitcoin_data.tx_type.pack(tx)) for tx in transactions[1:]] == other_transaction_hashes
+ assert transactions[0] == gentx and [bitcoin_data.hash256(bitcoin_data.tx_type.pack(tx)) for tx in transactions[1:]] == desired_other_transaction_hashes
min_header = dict(header);del min_header['merkle_root']
hash_link = prefix_to_hash_link(bitcoin_data.tx_type.pack(gentx)[:-32-4], cls.gentx_before_refhash)
- merkle_link = bitcoin_data.calculate_merkle_link([None] + other_transaction_hashes, 0)
+ merkle_link = bitcoin_data.calculate_merkle_link([None] + desired_other_transaction_hashes, 0)
pow_hash = net.PARENT.POW_FUNC(bitcoin_data.block_header_type.pack(header))
return cls(net, None, dict(
min_header=min_header, share_info=share_info, hash_link=hash_link,
ref_merkle_link=dict(branch=[], index=0),
), merkle_link=merkle_link, other_txs=transactions[1:] if pow_hash <= header['bits'].target else None)
- return share_info, gentx, other_transaction_hashes, get_share
+ return share_info, gentx, desired_other_transaction_hashes, get_share
@classmethod
def get_ref_hash(cls, net, share_info, ref_merkle_link):
@@ -258,7 +258,7 @@ def as_share(self):
return self.as_share1b()
def check(self, tracker):
- share_info, gentx, other_transaction_hashes, get_share = self.generate_transaction(tracker, self.share_info['share_data'], self.header['bits'].target, self.share_info['timestamp'], self.share_info['bits'].target, self.common['ref_merkle_link'], [], self.net) # ok because other_transaction_hashes is only used in get_share
+ share_info, gentx, other_transaction_hashes, get_share = self.generate_transaction(tracker, self.share_info['share_data'], self.header['bits'].target, self.share_info['timestamp'], self.share_info['bits'].target, self.common['ref_merkle_link'], [], self.net) # ok because desired_other_transaction_hashes is only used in get_share
if share_info != self.share_info:
raise ValueError('share_info invalid')
if bitcoin_data.hash256(bitcoin_data.tx_type.pack(gentx)) != self.gentx_hash:
View
@@ -207,7 +207,7 @@ def get_work(self, pubkey_hash, desired_share_target, desired_pseudoshare_target
desired_timestamp=int(time.time() + 0.5),
desired_target=desired_share_target,
ref_merkle_link=dict(branch=[], index=0),
- other_transaction_hashes=tx_hashes,
+ desired_other_transaction_hashes=tx_hashes,
net=self.net,
)

0 comments on commit 025c265

Please sign in to comment.