mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-26 05:48:20 +01:00
test: refactor: replace unnecessary BytesIO uses
Rather than needing to create intermediate stream variables, we can use helper functions like `tx_from_hex` instead or access the result directly, leading both to increased readability and less code.
This commit is contained in:
@@ -19,6 +19,7 @@ from test_framework.messages import (
|
||||
CTxInWitness,
|
||||
CTxOut,
|
||||
SEQUENCE_FINAL,
|
||||
tx_from_hex,
|
||||
)
|
||||
from test_framework.script import (
|
||||
ANNEX_TAG,
|
||||
@@ -109,7 +110,6 @@ from test_framework.address import (
|
||||
program_to_witness,
|
||||
)
|
||||
from collections import OrderedDict, namedtuple
|
||||
from io import BytesIO
|
||||
import json
|
||||
import hashlib
|
||||
import os
|
||||
@@ -1386,8 +1386,7 @@ class TaprootTest(BitcoinTestFramework):
|
||||
# Add change
|
||||
fund_tx.vout.append(CTxOut(balance - 10000, random.choice(host_spks)))
|
||||
# Ask the wallet to sign
|
||||
ss = BytesIO(bytes.fromhex(node.signrawtransactionwithwallet(fund_tx.serialize().hex())["hex"]))
|
||||
fund_tx.deserialize(ss)
|
||||
fund_tx = tx_from_hex(node.signrawtransactionwithwallet(fund_tx.serialize().hex())["hex"])
|
||||
# Construct UTXOData entries
|
||||
fund_tx.rehash()
|
||||
for i in range(count_this_tx):
|
||||
|
||||
Reference in New Issue
Block a user