def msg_tx(self, msg: TransactionsEthProtocolMessage) -> None: if len(msg.rawbytes() ) >= eth_common_constants.ETH_SKIP_TRANSACTIONS_SIZE: bytes_skipped_count = len(msg.rawbytes()) self.connection.log_debug( "Skipping {} bytes of transactions message.", bytes_skipped_count) gateway_transaction_stats_service.log_skipped_transaction_bytes( bytes_skipped_count) else: super().msg_tx(msg)
def test_tx_to_bx_tx__success(self): txs = [ mock_eth_messages.get_dummy_transaction(1), mock_eth_messages.get_dummy_transaction(2), mock_eth_messages.get_dummy_transaction(3), ] tx_msg = TransactionsEthProtocolMessage(None, txs) self.assertTrue(tx_msg.rawbytes()) self.validate_tx_to_bx_txs_conversion(tx_msg, txs)
def test_tx_to_bx_tx__from_bytes_single_tx_success(self): txs = [ mock_eth_messages.get_dummy_transaction(1), ] tx_msg = TransactionsEthProtocolMessage(None, txs) tx_msg_bytes = tx_msg.rawbytes() self.assertTrue(tx_msg_bytes) tx_msg_from_bytes = TransactionsEthProtocolMessage(tx_msg_bytes) self.validate_tx_to_bx_txs_conversion(tx_msg_from_bytes, txs)