test: introduce tx_from_hex helper for tx deserialization

`FromHex` is mostly used for transactions, so we introduce a
shortcut `tx_from_hex` for `FromHex(CTransaction, hex_str)`.
This commit is contained in:
Sebastian Falbesoner committed 2021-06-21 14:28:05 +02:00
1 parent 965e937434
commit 2ce7b47958
22 files changed
+257 -152

No files matched your search

+6 -2
View File
@@ -20,7 +20,11 @@ from test_framework.blocktools import (
create_block,
create_coinbase,
)
from test_framework.messages import CTransaction, FromHex, msg_pong, msg_tx
from test_framework.messages import (
msg_pong,
msg_tx,
tx_from_hex,
)
from test_framework.p2p import P2PDataStore, P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
@@ -89,7 +93,7 @@ class P2PEvict(BitcoinTestFramework):
'scriptPubKey': prevtx['vout'][0]['scriptPubKey']['hex'],
}],
)['hex']
txpeer.send_message(msg_tx(FromHex(CTransaction(), sigtx)))
txpeer.send_message(msg_tx(tx_from_hex(sigtx)))
protected_peers.add(current_peer)
self.log.info("Create 8 peers and protect them from eviction by having faster pings")