aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.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/test_framework/util.py
parent965e93743454112c0c3c66bf24852f63ee07b862 (diff)
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/test_framework/util.py')
-rw-r--r--test/functional/test_framework/util.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index f354ae0075..35dbfbba8d 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -19,7 +19,6 @@ import unittest
from . import coverage
from .authproxy import AuthServiceProxy, JSONRPCException
-from io import BytesIO
from typing import Callable, Optional
logger = logging.getLogger("TestFramework.utils")
@@ -528,7 +527,7 @@ def gen_return_txouts():
def create_lots_of_big_transactions(node, txouts, utxos, num, fee):
addr = node.getnewaddress()
txids = []
- from .messages import CTransaction
+ from .messages import tx_from_hex
for _ in range(num):
t = utxos.pop()
inputs = [{"txid": t["txid"], "vout": t["vout"]}]
@@ -536,8 +535,7 @@ def create_lots_of_big_transactions(node, txouts, utxos, num, fee):
change = t['amount'] - fee
outputs[addr] = satoshi_round(change)
rawtx = node.createrawtransaction(inputs, outputs)
- tx = CTransaction()
- tx.deserialize(BytesIO(hex_str_to_bytes(rawtx)))
+ tx = tx_from_hex(rawtx)
for txout in txouts:
tx.vout.append(txout)
newtx = tx.serialize().hex()