def test_bdn_stats_tx_new_from_node_low_fee(self): self.node.opts.blockchain_networks[ self.node.network_num].min_tx_network_fee = 500 blockchain_network = self.tx_blockchain_connection_protocol.connection.node.get_blockchain_network( ) blockchain_network.protocol = "ethereum" txs = [ mock_eth_messages.get_dummy_transaction(1, gas_price=5), ] tx_msg = TransactionsEthProtocolMessage(None, txs) self.assertEqual(1, len(tx_msg.get_transactions())) self.tx_blockchain_connection_protocol.msg_tx(tx_msg) self.assertEqual( 3, len(gateway_bdn_performance_stats_service.interval_data. blockchain_node_to_bdn_stats)) node_1_stats = gateway_bdn_performance_stats_service.interval_data.blockchain_node_to_bdn_stats[ self.node_1_endpoint] for endpoint, stats in gateway_bdn_performance_stats_service.interval_data.blockchain_node_to_bdn_stats.items( ): if endpoint == self.node_1_endpoint: continue self.assertEqual(0, stats.new_tx_received_from_bdn) self.assertEqual(0, node_1_stats.new_tx_received_from_blockchain_node) self.assertEqual( 1, node_1_stats.new_tx_received_from_blockchain_node_low_fee)
def test_open_ethereum_berlin_txs_message(self): msg = TransactionsEthProtocolMessage(eth_fixtures.OPEN_ETH_BERLIN_TXS_MESSAGE) txs = msg.get_transactions() self.assertEqual(56, len(txs)) for i, tx in enumerate(txs): if i == 28: self.assertIsInstance(tx, AccessListTransaction) else: self.assertIsInstance(tx, LegacyTransaction)
def _get_node_tx_message( self ) -> Tuple[Union[TxOntMessage, TransactionsEthProtocolMessage], List[Tuple[ Sha256Hash, Union[bytearray, memoryview]]]]: txs = [] for i in range(600): txs.append(mock_eth_messages.get_dummy_transaction(i + 1)) msg = TransactionsEthProtocolMessage(None, txs) return msg, list( map(lambda tx: (tx.hash(), tx.contents()), msg.get_transactions()))
def _get_node_tx_message( self ) -> Tuple[Union[TxOntMessage, TransactionsEthProtocolMessage], List[Tuple[ Sha256Hash, Union[bytearray, memoryview]]]]: txs = [ mock_eth_messages.get_dummy_transaction(1), mock_eth_messages.get_dummy_access_list_transaction(2) ] msg = TransactionsEthProtocolMessage(None, txs) # pyre-fixme [7]: Expected `Tuple[Union[TransactionsEthProtocolMessage, TxOntMessage], List[Tuple[Sha256Hash, Union[bytearray, memoryview]]]]` return msg, list( map(lambda tx: (tx.hash(), tx.contents()), msg.get_transactions()))