From 43389dd0d92d1b96dae02689d8995bce7c511a64 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 29 Nov 2026 17:04:40 +0000 Subject: [PATCH] proto: adjust `max_tx_fee` values for all supported coins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set these low enough to avoid significant loss but high enough so they’ll be exceeded only in rare situations (i.e. abnormally large network fees and/or transaction sizes). --- mmgen/data/mmgen.cfg | 13 ++++++++----- mmgen/proto/bch/params.py | 2 +- mmgen/proto/btc/params.py | 2 +- mmgen/proto/etc/params.py | 2 +- mmgen/proto/eth/params.py | 2 +- mmgen/proto/ltc/params.py | 2 +- mmgen/proto/rune/params.py | 2 +- test/cmdtest_d/automount.py | 1 + test/cmdtest_d/main.py | 29 ++++++++++++++++++++++++++--- 9 files changed, 41 insertions(+), 14 deletions(-) diff --git a/mmgen/data/mmgen.cfg b/mmgen/data/mmgen.cfg index d967f75b..ab554acc 100644 --- a/mmgen/data/mmgen.cfg +++ b/mmgen/data/mmgen.cfg @@ -143,19 +143,22 @@ # bch_cashaddr true # Set the maximum transaction fee for BTC: -# btc_max_tx_fee 0.003 +# btc_max_tx_fee 0.001 # Set the maximum transaction fee for BCH: -# bch_max_tx_fee 0.1 +# bch_max_tx_fee 0.2 # Set the maximum transaction fee for LTC: -# ltc_max_tx_fee 0.3 +# ltc_max_tx_fee 1.0 # Set the maximum transaction fee for ETH: -# eth_max_tx_fee 0.005 +# eth_max_tx_fee 0.02 + +# Set the maximum transaction fee for ETC: +# etc_max_tx_fee 1.0 # Set the maximum transaction fee for RUNE: -# rune_max_tx_fee 0.2 +# rune_max_tx_fee 5.0 # Set the Ethereum mainnet chain names (space-separated list, first is default): # eth_mainnet_chain_names ethereum foundation diff --git a/mmgen/proto/bch/params.py b/mmgen/proto/bch/params.py index 317a56cc..041a85bc 100644 --- a/mmgen/proto/bch/params.py +++ b/mmgen/proto/bch/params.py @@ -26,7 +26,7 @@ class mainnet(mainnet): ] caps = () coin_amt = 'BCHAmt' - max_tx_fee = 0.1 + max_tx_fee = 0.2 max_op_return_data_len = 80 cashaddr_pfx = 'bitcoincash' cashaddr = True diff --git a/mmgen/proto/btc/params.py b/mmgen/proto/btc/params.py index 7d35cf70..7bc3e25e 100644 --- a/mmgen/proto/btc/params.py +++ b/mmgen/proto/btc/params.py @@ -27,7 +27,7 @@ class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp preferred_mmtypes = ('B', 'S', 'C') dfl_mmtype = 'L' coin_amt = 'BTCAmt' - max_tx_fee = 0.003 + max_tx_fee = 0.001 has_chg = True sighash_type = 'ALL' block0 = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f' diff --git a/mmgen/proto/etc/params.py b/mmgen/proto/etc/params.py index d1679bdc..50d10bc8 100644 --- a/mmgen/proto/etc/params.py +++ b/mmgen/proto/etc/params.py @@ -14,7 +14,7 @@ from ..eth.params import mainnet class mainnet(mainnet): chain_names = ['classic', 'ethereum_classic'] - max_tx_fee = 0.005 + max_tx_fee = 1.0 coin_amt = 'ETCAmt' class testnet(mainnet): diff --git a/mmgen/proto/eth/params.py b/mmgen/proto/eth/params.py index b656b3b4..286f3b1c 100644 --- a/mmgen/proto/eth/params.py +++ b/mmgen/proto/eth/params.py @@ -25,7 +25,7 @@ class mainnet(CoinProtocol.DummyWIF, CoinProtocol.Secp256k1): pubkey_type = 'std' # required by DummyWIF coin_amt = 'ETHAmt' - max_tx_fee = 0.005 + max_tx_fee = 0.02 chain_names = ['ethereum', 'foundation'] sign_mode = 'standalone' caps = ('token',) diff --git a/mmgen/proto/ltc/params.py b/mmgen/proto/ltc/params.py index 49b0631d..28aeb88b 100644 --- a/mmgen/proto/ltc/params.py +++ b/mmgen/proto/ltc/params.py @@ -18,7 +18,7 @@ class mainnet(mainnet): wif_ver_num = {'std': 'b0'} mmtypes = ('L', 'C', 'S', 'B') coin_amt = 'LTCAmt' - max_tx_fee = 0.3 + max_tx_fee = 1.0 max_op_return_data_len = 80 base_coin = 'LTC' forks = [] diff --git a/mmgen/proto/rune/params.py b/mmgen/proto/rune/params.py index 2103cb8f..19f64a75 100644 --- a/mmgen/proto/rune/params.py +++ b/mmgen/proto/rune/params.py @@ -25,7 +25,7 @@ class mainnet(CoinProtocol.Secp256k1): preferred_mmtypes = ('X',) dfl_mmtype = 'X' coin_amt = 'UniAmt' - max_tx_fee = 0.2 + max_tx_fee = 5.0 caps = ('refreq') mmcaps = ('tw', 'rpc', 'rpc_init') base_proto = 'THORChain' diff --git a/test/cmdtest_d/automount.py b/test/cmdtest_d/automount.py index 788303cf..734e3458 100644 --- a/test/cmdtest_d/automount.py +++ b/test/cmdtest_d/automount.py @@ -370,6 +370,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest): sid = self._user_sid('alice') return self._alice_txbump( fee_opt = '--fee=400s', + extra_opts = [self.max_tx_fee_opt(0.002)], output_args = ['data:message for posterity', f'{self.burn_addr},7.654321', f'{sid}:C:1']) def alice_txbump6(self): diff --git a/test/cmdtest_d/main.py b/test/cmdtest_d/main.py index 381a1e74..ee1804f5 100644 --- a/test/cmdtest_d/main.py +++ b/test/cmdtest_d/main.py @@ -148,6 +148,9 @@ class CmdTestMain(CmdTestBase, CmdTestShared): ('addrgen1', (1, 'address generation', [[['mmdat'], 1]]) ), + ('txcreate1_bad', + (1, 'transaction creation, ‘max_tx_fee’ exceeded', [[['addrs'], 1]]) + ), ('txcreate1', (1, 'transaction creation', [[['addrs'], 1]]) ), @@ -336,6 +339,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): segwit_do = ( 'walletgen1', 'addrgen1', + 'txcreate1_bad', 'txcreate1', 'txbump1', 'txsign1', @@ -424,6 +428,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): txfile, save = save, has_label = has_label, + extra_opts = [self.max_tx_fee_opt(0.005)], dfl_wallet = True) def passchg_dfl_wallet(self, pf): @@ -782,6 +787,19 @@ class CmdTestMain(CmdTestBase, CmdTestShared): return t + def txcreate1_bad(self, addrfile): + if self.coin != 'btc': + return 'skip' + t = self.txcreate_common( + sources = ['1'], + add_output_args = ['hexdata:' + 'ee' * self.proto.max_op_return_data_len], + exit_val = 1) + t.expect('abel:\b', 'q') + t.expect('spend: ', '1\n') + t.expect('too high') + t.expect('fee: ', f'{self.proto.max_tx_fee}\n') + return t + def txcreate1(self, addrfile): return self.txcreate_common( sources = ['1'], @@ -789,7 +807,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): add_output_args = ['hexdata:' + 'ee' * self.proto.max_op_return_data_len]) def txsign1(self, *args, **kwargs): - t = self.txsign(*args, **kwargs) + t = self.txsign(*args, extra_opts=[self.max_tx_fee_opt(0.006)], **kwargs) return 'ok' if self.has_segfault_on_exit_bug else t def txbump1(self, txfile, prepend_args=[], seed_args=[]): @@ -798,7 +816,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): return 'skip' args = prepend_args + [ '--quiet', - '--btc-max-tx-fee=0.006', + self.max_tx_fee_opt(0.006), '--outdir='+self.tmpdir, txfile ] + seed_args @@ -959,6 +977,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): '-d', self.tmpdir, '-p1', '-M', keyaddr_file, + self.max_tx_fee_opt(0.006), txfile], no_passthru_opts = ['coin']) t.license() @@ -971,7 +990,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): return self.txcreate_common( sources = ['1'], cmdline_inputs = True, - add_opts = ['--yes']) + add_opts = ['--yes', self.max_tx_fee_opt(0.002)]) def walletgen2(self, del_dw_run='dummy'): return self.walletgen1(seed_len=128) @@ -988,6 +1007,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): def txsign2(self, wf1, txf1, wf2, txf2): t = self.spawn('mmgen-txsign', [ '-d', self.tmpdir, + self.max_tx_fee_opt(0.006), txf1, wf1, txf2, wf2], no_passthru_opts = ['coin']) t.license() @@ -1044,6 +1064,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): def txcreate4(self, f1, f2, f3, f4, f5, f6): return self.txcreate_common( sources = ['1', '2', '3', '4', '14'], + add_opts = [self.max_tx_fee_opt(0.002)], non_mmgen_input = '4', do_label = True, view = 'y', @@ -1056,6 +1077,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): '-i', 'brain', '-b' + self.bw_params, '-p1', + self.max_tx_fee_opt(0.002), '--keys-from-file=' + non_mm_file, '--mmgen-keys-from-file=' + f6] t = self.spawn('mmgen-txsign', add_opts + [f1, f2, f3, f4, f5], no_passthru_opts=['coin']) @@ -1076,6 +1098,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): '-i', 'brain', '-b'+self.bw_params, '-p1', + self.max_tx_fee_opt(0.002), '--keys-from-file=' + non_mm_file, '--mmgen-keys-from-file=' + f12] self.get_file_with_ext('sigtx', delete_all=True) # delete tx signed by txsign4