From: Forrest Voight Date: Thu, 24 Nov 2011 17:59:46 +0000 (-0500) Subject: Merge branch 'master' into optional_donation X-Git-Tag: 0.8.2~153^2~28 X-Git-Url: https://git.novaco.in/?a=commitdiff_plain;h=5da8fcbcd4f9758f076f7077f423dc36988385f1;p=p2pool.git Merge branch 'master' into optional_donation Conflicts: p2pool/data.py p2pool/main.py --- 5da8fcbcd4f9758f076f7077f423dc36988385f1 diff --cc p2pool/data.py index 6208cc6,0a51836..d90d45f --- a/p2pool/data.py +++ b/p2pool/data.py @@@ -749,10 -558,10 +749,10 @@@ class BitcoinMainnet(networks.BitcoinMa NAME = 'bitcoin' P2P_PORT = 9333 MAX_TARGET = 2**256//2**32 - 1 - PERSIST = True + PERSIST = False WORKER_PORT = 9332 - class BitcoinTestnet(bitcoin_data.Testnet): + class BitcoinTestnet(networks.BitcoinTestnet): SHARE_PERIOD = 1 # seconds CHAIN_LENGTH = 24*60*60//5 # shares TARGET_LOOKBEHIND = 200 # shares diff --cc p2pool/main.py index 3e598cd,5885b8e..ee8d76b --- a/p2pool/main.py +++ b/p2pool/main.py @@@ -495,23 -475,20 +495,23 @@@ def main(args) try: # match up with transactions header = bitcoin.getwork.decode_data(data) - transactions = merkle_root_to_transactions.get(header['merkle_root'], None) - if transactions is None: + xxx = merkle_root_to_transactions.get(header['merkle_root'], None) + if xxx is None: print '''Couldn't link returned work's merkle root with its transactions - should only happen if you recently restarted p2pool''' return False - block = dict(header=header, txs=transactions) - hash_ = bitcoin.data.block_header_type.hash256(block['header']) + is_new, share_info, transactions = xxx + new_share_info = share_info + + hash_ = bitcoin.data.block_header_type.hash256(header) + - pow = bitcoin.data.block_header_type.scrypt(header) if getattr(args.net, 'BITCOIN_POW_SCRYPT', False) else hash_ + pow_hash = args.net.BITCOIN_POW_FUNC(block['header']) - if pow <= header['target'] or p2pool_init.DEBUG: - if pow_hash <= block['header']['target'] or p2pool_init.DEBUG: ++ if pow_hash <= header['target'] or p2pool_init.DEBUG: if factory.conn.value is not None: - factory.conn.value.send_block(block=block) + factory.conn.value.send_block(block=dict(header=header, txs=transactions)) else: print 'No bitcoind connection! Erp!' - if pow <= header['target']: - if pow_hash <= block['header']['target']: ++ if pow_hash <= header['target']: print print 'GOT BLOCK! Passing to bitcoind! bitcoin: %x' % (hash_,) print @@@ -539,14 -516,11 +539,14 @@@ except: log.err(None, 'Error while processing merged mining POW:') - target = p2pool.coinbase_type.unpack(transactions[0]['tx_ins'][0]['script'])['share_data']['target'] + target = new_share_info['target'] - if pow > target: - print 'Worker submitted share with hash > target:\nhash : %x\ntarget: %x' % (pow, target) + if pow_hash > target: + print 'Worker submitted share with hash > target:\nhash : %x\ntarget: %x' % (pow_hash, target) return False - share = p2pool.Share.from_block(block, args.net) + if is_new: + share = p2pool.NewShare(args.net, header, new_share_info, other_txs=transactions[1:]) + else: + share = p2pool.Share(args.net, header, share_info, other_txs=transactions[1:]) my_shares.add(share.hash) if share.previous_hash != current_work.value['best_share_hash']: doa_shares.add(share.hash)