def msg_confirmed_tx(self, msg: ConfirmedTxMessage) -> None:
        tx_hash = msg.tx_hash()
        transaction_key = self.node.get_tx_service().get_transaction_key(
            tx_hash)
        tx_contents = msg.tx_val()

        # shouldn't ever happen, but just in case
        if tx_contents == ConfirmedTxMessage.EMPTY_TX_VAL:
            tx_contents = cast(
                Optional[memoryview],
                self.node.get_tx_service().get_transaction_by_key(
                    transaction_key))
            if tx_contents is None:
                transaction_feed_stats_service.log_pending_transaction_missing_contents(
                )
                return

        self.node.feed_manager.publish_to_feed(
            FeedKey(EthPendingTransactionFeed.NAME),
            EthRawTransaction(tx_hash,
                              tx_contents,
                              FeedSource.BDN_SOCKET,
                              local_region=True))

        transaction_feed_stats_service.log_pending_transaction_from_internal(
            tx_hash)
예제 #2
0
    def process_transaction_with_parsed_contents(
            self, tx_hash: Sha256Hash, parsed_tx: Optional[Dict[str,
                                                                Any]]) -> None:
        transaction_feed_stats_service.log_pending_transaction_from_local(
            tx_hash)

        if parsed_tx is None:
            logger.debug(log_messages.TRANSACTION_NOT_FOUND_IN_MEMPOOL,
                         tx_hash)
            transaction_feed_stats_service.log_pending_transaction_missing_contents(
            )
        else:
            self.feed_manager.publish_to_feed(
                EthPendingTransactionFeed.NAME,
                EthRawTransaction(tx_hash, parsed_tx))
예제 #3
0
    def process_transaction_with_parsed_contents(
            self, tx_hash: Sha256Hash, parsed_tx: Optional[Dict[str,
                                                                Any]]) -> None:
        transaction_feed_stats_service.log_pending_transaction_from_local(
            tx_hash)

        if parsed_tx is None:
            logger.debug(log_messages.TRANSACTION_NOT_FOUND_IN_MEMPOOL,
                         tx_hash)
            transaction_feed_stats_service.log_pending_transaction_missing_contents(
            )
        else:
            gas_price = int(parsed_tx["gasPrice"], 16)
            if gas_price >= self.node.get_network_min_transaction_fee():
                self.feed_manager.publish_to_feed(
                    EthPendingTransactionFeed.NAME,
                    EthRawTransaction(tx_hash, parsed_tx,
                                      FeedSource.BLOCKCHAIN_RPC))