Exemplo n.º 1
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)
    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())