From e6cb2f9587005c27ce47f2ebc8ed50b665d3bcf3 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 20 Oct 2026 17:38:48 +0000 Subject: [PATCH] CoinProtocol.Base: new `has_chg` attr --- mmgen/proto/btc/params.py | 1 + mmgen/protocol.py | 1 + mmgen/tx/new_swap.py | 6 ++---- test/cmdtest_d/swap.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mmgen/proto/btc/params.py b/mmgen/proto/btc/params.py index d54ce07f..7d35cf70 100644 --- a/mmgen/proto/btc/params.py +++ b/mmgen/proto/btc/params.py @@ -28,6 +28,7 @@ class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp dfl_mmtype = 'L' coin_amt = 'BTCAmt' max_tx_fee = 0.003 + has_chg = True sighash_type = 'ALL' block0 = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f' forks = [ diff --git a/mmgen/protocol.py b/mmgen/protocol.py index 83ce6f38..2bf77970 100644 --- a/mmgen/protocol.py +++ b/mmgen/protocol.py @@ -56,6 +56,7 @@ class CoinProtocol(MMGenObject): chain_names = None is_vm = False is_evm = False + has_chg = False has_usr_fee = True coin_amt = None max_tx_fee = None diff --git a/mmgen/tx/new_swap.py b/mmgen/tx/new_swap.py index 085cf2e1..8f7623f0 100644 --- a/mmgen/tx/new_swap.py +++ b/mmgen/tx/new_swap.py @@ -105,9 +105,7 @@ class NewSwap(BaseSwapMethods, New): arg = get_arg() # arg 3: optional chg_spec (change address spec, requires amt) - if args.send_amt and not ( - self.proto.is_vm or - arg in sa.recv): # is change arg + if self.proto.has_chg and args.send_amt and not arg in sa.recv: # is change arg nonlocal chg_output if not self.cfg.quote: chg_output = await self.get_chg_output(arg, addrfiles) @@ -154,7 +152,7 @@ class NewSwap(BaseSwapMethods, New): get_char('Press any key to continue: ') msg('') - if args.send_amt and not (chg_output or self.proto.is_vm): + if self.proto.has_chg and args.send_amt and not chg_output: chg_output = await self.get_chg_output(None, addrfiles) if self.refnum: diff --git a/test/cmdtest_d/swap.py b/test/cmdtest_d/swap.py index 791a87eb..e77346f9 100644 --- a/test/cmdtest_d/swap.py +++ b/test/cmdtest_d/swap.py @@ -233,7 +233,7 @@ class CmdTestSwapMethods: t.expect('(Y/n): ', 'y') # fee ok? t.expect('(Y/n): ', 'y') # change ok? else: - if not (self.proto.is_vm or single_output): + if self.proto.has_chg and not single_output: t.expect('ENTER for the change output): ', '\n') t.expect('(Y/n): ', 'y') # confirm deduct from chg output t.expect('to continue: ', '\n') # exit swap quote