@@ -15,14 +15,12 @@ import sys
15
15
import time
16
16
import subprocess
17
17
18
- from io import BytesIO
19
-
20
18
PATH_BASE_CONTRIB_SIGNET = os .path .abspath (os .path .dirname (os .path .realpath (__file__ )))
21
19
PATH_BASE_TEST_FUNCTIONAL = os .path .abspath (os .path .join (PATH_BASE_CONTRIB_SIGNET , ".." , ".." , "test" , "functional" ))
22
20
sys .path .insert (0 , PATH_BASE_TEST_FUNCTIONAL )
23
21
24
22
from 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
26
24
from test_framework .script import CScriptOp # noqa: E402
27
25
28
26
logging .basicConfig (
@@ -36,19 +34,6 @@ RE_MULTIMINER = re.compile("^(\d+)(-(\d+))?/(\d+)$")
36
34
37
35
# #### some helpers that could go into test_framework
38
36
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
-
52
37
class PSBTMap :
53
38
"""Class for serializing and deserializing PSBT maps"""
54
39
0 commit comments