@@ -15,14 +15,12 @@ import sys
1515import time
1616import subprocess
1717
18- from io import BytesIO
19-
2018PATH_BASE_CONTRIB_SIGNET = os .path .abspath (os .path .dirname (os .path .realpath (__file__ )))
2119PATH_BASE_TEST_FUNCTIONAL = os .path .abspath (os .path .join (PATH_BASE_CONTRIB_SIGNET , ".." , ".." , "test" , "functional" ))
2220sys .path .insert (0 , PATH_BASE_TEST_FUNCTIONAL )
2321
2422from test_framework .blocktools import get_witness_script , script_BIP34_coinbase_height # noqa: E402
25- from test_framework .messages import CBlock , CBlockHeader , COutPoint , CTransaction , CTxIn , CTxInWitness , CTxOut , from_hex , deser_string , ser_compact_size , ser_string , ser_uint256 , tx_from_hex # noqa: E402
23+ from test_framework .messages import CBlock , CBlockHeader , COutPoint , CTransaction , CTxIn , CTxInWitness , CTxOut , from_binary , from_hex , deser_string , ser_compact_size , ser_string , ser_uint256 , tx_from_hex # noqa: E402
2624from test_framework .script import CScriptOp # noqa: E402
2725
2826logging .basicConfig (
@@ -36,19 +34,6 @@ RE_MULTIMINER = re.compile("^(\d+)(-(\d+))?/(\d+)$")
3634
3735# #### some helpers that could go into test_framework
3836
39- # like from_hex, but without the hex part
40- def from_binary (cls , stream ):
41- """deserialize a binary stream (or bytes object) into an object"""
42- # handle bytes object by turning it into a stream
43- was_bytes = isinstance (stream , bytes )
44- if was_bytes :
45- stream = BytesIO (stream )
46- obj = cls ()
47- obj .deserialize (stream )
48- if was_bytes :
49- assert len (stream .read ()) == 0
50- return obj
51-
5237class PSBTMap :
5338 """Class for serializing and deserializing PSBT maps"""
5439
0 commit comments