コード例 #1
0
ファイル: node.py プロジェクト: nigeriacoin/p2pool
 def handle_header(new_header):
     # check that header matches current target
     if not (bitcoin_data.skeinhash256(bitcoin_data.block_header_type.pack(new_header)) <= self.bitcoind_work.value['bits'].target):
         return
     bitcoind_best_block = self.bitcoind_work.value['previous_block']
     
     if (self.best_block_header.value is None
         or (
             new_header['previous_block'] == bitcoind_best_block and
             
             bitcoin_data.skeinhash256(bitcoin_data.block_header_type.pack(self.best_block_header.value)) == bitcoind_best_block
         ) # new is child of current and previous is current
         or (
             bitcoin_data.skeinhash256(bitcoin_data.block_header_type.pack(new_header)) == bitcoind_best_block and
             self.best_block_header.value['previous_block'] != bitcoind_best_block
         )): # new is current and previous is not a child of current
         self.best_block_header.set(new_header)
コード例 #2
0
ファイル: node.py プロジェクト: nigeriacoin/p2pool
 def handle_bestblock(self, header, peer):
     if bitcoin_data.skeinhash256(bitcoin_data.block_header_type.pack(header)) > header['bits'].target:
         raise p2p.PeerMisbehavingError('received block header fails PoW test')
     self.node.handle_header(header)