CoinProtocol.Base: new has_chg attr

This commit is contained in:
The MMGen Project 2026-10-20 17:38:48 +00:00
commit e6cb2f9587
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 5 additions and 5 deletions

View file

@ -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 = [

View file

@ -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

View file

@ -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:

View file

@ -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