From 00227b3d739ef573683a7935870541990b8b0910 Mon Sep 17 00:00:00 2001 From: MMGen Date: Wed, 27 Mar 2019 18:49:41 +0000 Subject: [PATCH] protocol.py: add 'base_proto' attribute; minor changes --- mmgen/protocol.py | 2 ++ mmgen/tool.py | 2 +- mmgen/tx.py | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mmgen/protocol.py b/mmgen/protocol.py index 62ef094f..6eb69583 100755 --- a/mmgen/protocol.py +++ b/mmgen/protocol.py @@ -86,6 +86,7 @@ class BitcoinProtocol(MMGenObject): caps = ('rbf','segwit') mmcaps = ('key','addr','rpc','tx') base_coin = 'BTC' + base_proto = 'Bitcoin' # From BIP173: witness version 'n' is stored as 'OP_n'. OP_0 is encoded as 0x00, # but OP_1 through OP_16 are encoded as 0x51 though 0x60 (81 to 96 in decimal). witness_vernum_hex = '00' @@ -316,6 +317,7 @@ class EthereumProtocol(DummyWIF,BitcoinProtocol): chain_name = 'foundation' sign_mode = 'standalone' caps = ('token',) + base_proto = 'Ethereum' @classmethod def verify_addr(cls,addr,hex_width,return_dict=False): diff --git a/mmgen/tool.py b/mmgen/tool.py index cdc36151..aca68549 100755 --- a/mmgen/tool.py +++ b/mmgen/tool.py @@ -343,7 +343,7 @@ class MMGenToolCmdCoin(MMGenToolCmdBase): """ cryptocoin key/address utilities - May require use of the '--coin' and '--type' options + May require use of the '--coin', '--type' and/or '--testnet' options Examples: mmgen-tool --coin=ltc --type=bech32 wif2addr diff --git a/mmgen/tx.py b/mmgen/tx.py index d5575eac..49c0a1d0 100755 --- a/mmgen/tx.py +++ b/mmgen/tx.py @@ -230,7 +230,7 @@ class MMGenTxIO(MMGenListItem): valid_attrs_extra = {'amt'} # Setting self.amt is runtime-dependent, so make it a property - # Make underlying self._amt an MMGenImmutableAttr so that reassignment is prevented + # Make underlying self._amt an MMGenImmutableAttr to prevent reassignment @property def amt(self): if type(self._amt) != g.proto.coin_amt: @@ -1426,18 +1426,18 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam change_amt = self.get_inputs_from_user(tw) - # only after we have inputs - if opt.rbf: self.inputs[0].sequence = g.max_int - 2 # handles the locktime case too - elif locktime: self.inputs[0].sequence = g.max_int - 1 - self.update_change_output(change_amt) self.update_send_amt(change_amt) + if g.proto.base_proto == 'Bitcoin': + if opt.rbf: self.inputs[0].sequence = g.max_int - 2 # handles the locktime case too + elif locktime: self.inputs[0].sequence = g.max_int - 1 + if not opt.yes: self.add_comment() # edits an existing comment self.create_raw() # creates self.hex, self.txid - if locktime: + if g.proto.base_proto == 'Bitcoin' and locktime: msg('Setting nlocktime to {}!'.format(strfmt_locktime(locktime))) self.set_hex_locktime(locktime) self.update_txid()