aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_listtransactions.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/wallet_listtransactions.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/wallet_listtransactions.py')
-rwxr-xr-xtest/functional/wallet_listtransactions.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/test/functional/wallet_listtransactions.py b/test/functional/wallet_listtransactions.py
index 71573964de..8b503f5971 100755
--- a/test/functional/wallet_listtransactions.py
+++ b/test/functional/wallet_listtransactions.py
@@ -4,22 +4,17 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listtransactions API."""
from decimal import Decimal
-from io import BytesIO
-from test_framework.messages import COIN, CTransaction
+from test_framework.messages import (
+ COIN,
+ tx_from_hex,
+)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_array_result,
assert_equal,
- hex_str_to_bytes,
)
-def tx_from_hex(hexstring):
- tx = CTransaction()
- f = BytesIO(hex_str_to_bytes(hexstring))
- tx.deserialize(f)
- return tx
-
class ListTransactionsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2