def test_btc_tx_msg_to_tx_msg__success(self):
        btc_tx_msg = mock_btc_messages.generate_btc_tx()
        network_num = 12345

        tx_msgs = self.btc_message_converter.tx_to_bx_txs(btc_tx_msg, network_num)

        self.assertTrue(tx_msgs)
        self.assertIsInstance(tx_msgs[0][0], TxMessage)
        self.assertEqual(tx_msgs[0][0].network_num(), network_num)
        self.assertEqual(tx_msgs[0][1], btc_tx_msg.tx_hash())
        self.assertEqual(tx_msgs[0][2], btc_tx_msg.tx())
    def test_tx_msg_to_btc_tx_msg__success(self):
        tx_hash = Sha256Hash(helpers.generate_bytearray(SHA256_HASH_LEN))
        tx = mock_btc_messages.generate_btc_tx().payload()

        tx_msg = TxMessage(message_hash=tx_hash, network_num=12345, tx_val=tx)

        btc_tx_msg = self.btc_message_converter.bx_tx_to_tx(tx_msg)

        self.assertTrue(btc_tx_msg)
        self.assertEqual(btc_tx_msg.magic(), self.MAGIC)
        self.assertEqual(btc_tx_msg.command(), b"tx")
        self.assertEqual(btc_tx_msg.payload(), tx)
    def test_tx_msg_to_btc_tx_msg__type_error(self):
        btc_tx_msg = mock_btc_messages.generate_btc_tx()

        self.assertRaises(TypeError, self.btc_message_converter.bx_tx_to_tx, btc_tx_msg)