Skip to content

Commit 597a4b3

Browse files
committed
scripted-diff: rename FromBinary helper to from_binary (signet miner)
-BEGIN VERIFY SCRIPT- sed -i s/FromBinary/from_binary/g ./contrib/signet/miner -END VERIFY SCRIPT-
1 parent 948f5ba commit 597a4b3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

contrib/signet/miner

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RE_MULTIMINER = re.compile("^(\d+)(-(\d+))?/(\d+)$")
3737
# #### some helpers that could go into test_framework
3838

3939
# like from_hex, but without the hex part
40-
def FromBinary(cls, stream):
40+
def from_binary(cls, stream):
4141
"""deserialize a binary stream (or bytes object) into an object"""
4242
# handle bytes object by turning it into a stream
4343
was_bytes = isinstance(stream, bytes)
@@ -89,19 +89,19 @@ class PSBT:
8989

9090
def deserialize(self, f):
9191
assert f.read(5) == b"psbt\xff"
92-
self.g = FromBinary(PSBTMap, f)
92+
self.g = from_binary(PSBTMap, f)
9393
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]
9797
return self
9898

9999
def serialize(self):
100100
assert isinstance(self.g, PSBTMap)
101101
assert isinstance(self.i, list) and all(isinstance(x, PSBTMap) for x in self.i)
102102
assert isinstance(self.o, list) and all(isinstance(x, PSBTMap) for x in self.o)
103103
assert 0 in self.g.map
104-
tx = FromBinary(CTransaction, self.g.map[0])
104+
tx = from_binary(CTransaction, self.g.map[0])
105105
assert len(tx.vin) == len(self.i)
106106
assert len(tx.vout) == len(self.o)
107107

@@ -113,7 +113,7 @@ class PSBT:
113113

114114
@classmethod
115115
def from_base64(cls, b64psbt):
116-
return FromBinary(cls, base64.b64decode(b64psbt))
116+
return from_binary(cls, base64.b64decode(b64psbt))
117117

118118
# #####
119119

@@ -178,7 +178,7 @@ def do_decode_psbt(b64psbt):
178178
scriptSig = psbt.i[0].map.get(7, b"")
179179
scriptWitness = psbt.i[0].map.get(8, b"\x00")
180180

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
182182

183183
def finish_block(block, signet_solution, grind_cmd):
184184
block.vtx[0].vout[-1].scriptPubKey += CScriptOp.encode_op_pushdata(SIGNET_HEADER + signet_solution)

0 commit comments

Comments
 (0)