예제 #1
0
    def msg_block(self, msg: NewBlockEthProtocolMessage):
        if not self.node.should_process_block_hash(msg.block_hash()):
            return

        self.node.set_known_total_difficulty(msg.block_hash(), msg.chain_difficulty())

        internal_new_block_msg = InternalEthBlockInfo.from_new_block_msg(msg)
        super().msg_block(internal_new_block_msg)
    def msg_block(self, msg: NewBlockEthProtocolMessage) -> None:
        if not self.node.should_process_block_hash(msg.block_hash()):
            return

        self.node.set_known_total_difficulty(msg.block_hash(),
                                             msg.get_chain_difficulty())

        internal_new_block_msg = InternalEthBlockInfo.from_new_block_msg(msg)
        self.process_msg_block(internal_new_block_msg, msg.number())

        if self.node.opts.filter_txs_factor > 0:
            self.node.on_transactions_in_block(msg.txns())
예제 #3
0
 def clean_block_transactions(
         self, block_msg: NewBlockEthProtocolMessage,
         transaction_service: TransactionService) -> None:
     block_hash = block_msg.block_hash()
     transactions_list = block_msg.txns()
     self.clean_block_transactions_by_block_components(
         block_hash=block_hash,
         transactions_list=(tx.hash() for tx in transactions_list),
         transaction_service=transaction_service)
예제 #4
0
 def test_msg_block_in_recovery(self):
     message = NewBlockEthProtocolMessage(
         None, _block_with_timestamp(time.time()), 10)
     self.node.block_recovery_service.add_block(message.rawbytes(),
                                                message.block_hash(), [1],
                                                [])
     self.sut.msg_block(message)
     self.node.block_processing_service.queue_block_for_processing.assert_not_called(
     )