aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_segwit.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-06-15 23:02:28 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-06-21 14:28:05 +0200
commit2ce7b47958c4a10ba20dc86c011d71cda4b070a5 (patch)
tree9d3ad9433f7b5b054f5b072ebf33462399d9f502 /test/functional/p2p_segwit.py
parent965e93743454112c0c3c66bf24852f63ee07b862 (diff)
downloadbitcoin-2ce7b47958c4a10ba20dc86c011d71cda4b070a5.tar.xz
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)`.
Diffstat (limited to 'test/functional/p2p_segwit.py')
-rwxr-xr-xtest/functional/p2p_segwit.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py
index 9d32c1cb86..95c7aec318 100755
--- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -40,8 +40,8 @@ from test_framework.messages import (
ser_uint256,
ser_vector,
sha256,
+ tx_from_hex,
uint256_from_str,
- FromHex,
)
from test_framework.p2p import (
P2PInterface,
@@ -2122,14 +2122,14 @@ class SegWitTest(BitcoinTestFramework):
unspent = next(u for u in self.nodes[0].listunspent() if u['spendable'] and u['address'].startswith('bcrt'))
raw = self.nodes[0].createrawtransaction([{"txid": unspent['txid'], "vout": unspent['vout']}], {self.nodes[0].getnewaddress(): 1})
- tx = FromHex(CTransaction(), raw)
+ tx = tx_from_hex(raw)
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
with self.nodes[0].assert_debug_log(['Superfluous witness record']):
self.test_node.send_and_ping(msg_bogus_tx(tx))
raw = self.nodes[0].signrawtransactionwithwallet(raw)
assert raw['complete']
raw = raw['hex']
- tx = FromHex(CTransaction(), raw)
+ tx = tx_from_hex(raw)
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
with self.nodes[0].assert_debug_log(['Unknown transaction optional data']):
self.test_node.send_and_ping(msg_bogus_tx(tx))