From d6b6d19254d288514ed956c98ea1f9111a94aa88 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 21 Jan 2022 11:23:44 +0000 Subject: [PATCH] g.max_int -> CoinProtocol.Bitcoin.max_int --- mmgen/globalvars.py | 2 -- mmgen/protocol.py | 1 + mmgen/tx.py | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mmgen/globalvars.py b/mmgen/globalvars.py index a5dd7763..7e053459 100755 --- a/mmgen/globalvars.py +++ b/mmgen/globalvars.py @@ -62,8 +62,6 @@ class GlobalContext(Lockable): version = files('mmgen').joinpath('data','version').read_text().strip() release_date = files('mmgen').joinpath('data','release_date').read_text().strip() - max_int = 0xffffffff - stdin_tty = sys.stdin.isatty() stdout = sys.stdout stderr = sys.stderr diff --git a/mmgen/protocol.py b/mmgen/protocol.py index b3dbb3a6..e588c6be 100755 --- a/mmgen/protocol.py +++ b/mmgen/protocol.py @@ -237,6 +237,7 @@ class CoinProtocol(MMGenObject): max_halvings = 64 start_subsidy = 50 ignore_daemon_version = False + max_int = 0xffffffff def bytes2wif(self,privbytes,pubkey_type,compressed): # input is preprocessed hex assert len(privbytes) == self.privkey_len, f'{len(privbytes)} bytes: incorrect private key length!' diff --git a/mmgen/tx.py b/mmgen/tx.py index ce6abce9..e5614ba0 100755 --- a/mmgen/tx.py +++ b/mmgen/tx.py @@ -922,9 +922,9 @@ class MMGenTX: self.outputs.sort_bip69() # do this only after inputs are sorted if opt.rbf: - self.inputs[0].sequence = g.max_int - 2 # handles the nLockTime case too + self.inputs[0].sequence = self.proto.max_int - 2 # handles the nLockTime case too elif locktime: - self.inputs[0].sequence = g.max_int - 1 + self.inputs[0].sequence = self.proto.max_int - 1 if not opt.yes: self.add_comment() # edits an existing comment @@ -1022,10 +1022,10 @@ class MMGenTX: # def is_replaceable_from_rpc(self): # dec_tx = await self.rpc.call('decoderawtransaction',self.hex) -# return None < dec_tx['vin'][0]['sequence'] <= g.max_int - 2 +# return None < dec_tx['vin'][0]['sequence'] <= self.proto.max_int - 2 def is_replaceable(self): - return self.inputs[0].sequence == g.max_int - 2 + return self.inputs[0].sequence == self.proto.max_int - 2 def check_txfile_hex_data(self): self.hex = HexStr(self.hex) @@ -1330,7 +1330,7 @@ class MMGenTX: raise TxHexMismatch((m2+m).format(desc.capitalize())) seq_hex = [int(i['nSeq'],16) for i in dtx['txins']] - seq_mmgen = [i.sequence or g.max_int for i in self.inputs] + seq_mmgen = [i.sequence or self.proto.max_int for i in self.inputs] check_equal('sequence numbers',seq_hex,seq_mmgen) d_hex = sorted((i['txid'],i['vout']) for i in dtx['txins'])