import p2pool, p2pool.data as p2pool_data
class WorkerBridge(worker_interface.WorkerBridge):
+ COINBASE_NONCE_LENGTH = 4
+
def __init__(self, node, my_pubkey_hash, donation_percentage, merged_urls, worker_fee):
worker_interface.WorkerBridge.__init__(self)
self.recent_shares_ts_work = []
'doa' if doas > doas_recorded_in_chain else
None
)(*self.get_stale_counts()),
- desired_version=share_type.SUCCESSOR.VERSION if share_type.SUCCESSOR is not None else share_type.VERSION,
+ desired_version=10,
),
block_target=self.current_work.value['bits'].target,
desired_timestamp=int(time.time() + 0.5),
received_header_hashes = set()
- def got_response(header, user, last_txout_nonce):
- new_packed_gentx = packed_gentx[:-4-4] + pack.IntType(32).pack(last_txout_nonce) + packed_gentx[-4:] if last_txout_nonce != 0 else packed_gentx
- new_gentx = bitcoin_data.tx_type.unpack(new_packed_gentx) if last_txout_nonce != 0 else gentx
+ def got_response(header, user, coinbase_nonce):
+ assert len(coinbase_nonce) == self.COINBASE_NONCE_LENGTH == 4
+ new_packed_gentx = packed_gentx[:-4-4] + coinbase_nonce + packed_gentx[-4:] if coinbase_nonce != '\0'*self.COINBASE_NONCE_LENGTH else packed_gentx
+ new_gentx = bitcoin_data.tx_type.unpack(new_packed_gentx) if coinbase_nonce != '\0'*self.COINBASE_NONCE_LENGTH else gentx
header_hash = bitcoin_data.hash256(bitcoin_data.block_header_type.pack(header))
pow_hash = self.node.net.PARENT.POW_FUNC(bitcoin_data.block_header_type.pack(header))
log.err(None, 'Error while processing merged mining POW:')
if pow_hash <= share_info['bits'].target and header_hash not in received_header_hashes:
- share = get_share(header, last_txout_nonce)
+ share = get_share(header, pack.IntType(32).unpack(coinbase_nonce))
print 'GOT SHARE! %s %s prev %s age %.2fs%s' % (
user,