@@ -37,7 +37,7 @@ RE_MULTIMINER = re.compile("^(\d+)(-(\d+))?/(\d+)$")
37
37
# #### some helpers that could go into test_framework
38
38
39
39
# like from_hex, but without the hex part
40
- def FromBinary (cls , stream ):
40
+ def from_binary (cls , stream ):
41
41
"""deserialize a binary stream (or bytes object) into an object"""
42
42
# handle bytes object by turning it into a stream
43
43
was_bytes = isinstance (stream , bytes )
@@ -89,19 +89,19 @@ class PSBT:
89
89
90
90
def deserialize (self , f ):
91
91
assert f .read (5 ) == b"psbt\xff "
92
- self .g = FromBinary (PSBTMap , f )
92
+ self .g = from_binary (PSBTMap , f )
93
93
assert 0 in self .g .map
94
- self .tx = FromBinary (CTransaction , self .g .map [0 ])
95
- self .i = [FromBinary (PSBTMap , f ) for _ in self .tx .vin ]
96
- self .o = [FromBinary (PSBTMap , f ) for _ in self .tx .vout ]
94
+ self .tx = from_binary (CTransaction , self .g .map [0 ])
95
+ self .i = [from_binary (PSBTMap , f ) for _ in self .tx .vin ]
96
+ self .o = [from_binary (PSBTMap , f ) for _ in self .tx .vout ]
97
97
return self
98
98
99
99
def serialize (self ):
100
100
assert isinstance (self .g , PSBTMap )
101
101
assert isinstance (self .i , list ) and all (isinstance (x , PSBTMap ) for x in self .i )
102
102
assert isinstance (self .o , list ) and all (isinstance (x , PSBTMap ) for x in self .o )
103
103
assert 0 in self .g .map
104
- tx = FromBinary (CTransaction , self .g .map [0 ])
104
+ tx = from_binary (CTransaction , self .g .map [0 ])
105
105
assert len (tx .vin ) == len (self .i )
106
106
assert len (tx .vout ) == len (self .o )
107
107
@@ -113,7 +113,7 @@ class PSBT:
113
113
114
114
@classmethod
115
115
def from_base64 (cls , b64psbt ):
116
- return FromBinary (cls , base64 .b64decode (b64psbt ))
116
+ return from_binary (cls , base64 .b64decode (b64psbt ))
117
117
118
118
# #####
119
119
@@ -178,7 +178,7 @@ def do_decode_psbt(b64psbt):
178
178
scriptSig = psbt .i [0 ].map .get (7 , b"" )
179
179
scriptWitness = psbt .i [0 ].map .get (8 , b"\x00 " )
180
180
181
- return FromBinary (CBlock , psbt .g .map [PSBT_SIGNET_BLOCK ]), ser_string (scriptSig ) + scriptWitness
181
+ return from_binary (CBlock , psbt .g .map [PSBT_SIGNET_BLOCK ]), ser_string (scriptSig ) + scriptWitness
182
182
183
183
def finish_block (block , signet_solution , grind_cmd ):
184
184
block .vtx [0 ].vout [- 1 ].scriptPubKey += CScriptOp .encode_op_pushdata (SIGNET_HEADER + signet_solution )
0 commit comments