From 0ab5b6560c4161062b719f598caa7ea26c79ae11 Mon Sep 17 00:00:00 2001 From: AlexCato Date: Wed, 21 Aug 2019 01:12:21 +0200 Subject: [PATCH] Redefine cli-option --txfee: Treat it as txfee to be used in the JM TX's instead of just for preliminary estimations. Now it is a way to temporarily override the tx_fees setting in joinmarket.cfg and behaves exactly the same way as describes there. --- scripts/cli_options.py | 10 ++++++---- scripts/sendpayment.py | 4 ++++ scripts/tumbler.py | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/cli_options.py b/scripts/cli_options.py index 8f0bb75..3adad11 100644 --- a/scripts/cli_options.py +++ b/scripts/cli_options.py @@ -29,10 +29,12 @@ def add_common_options(parser): type='int', dest='txfee', default=-1, - help='number of satoshis per participant to use as the initial estimate ' - 'for the total transaction fee, default=dynamically estimated, note that this is adjusted ' - 'based on the estimated fee calculated after tx construction, based on ' - 'policy set in joinmarket.cfg.') + help='Bitcoin miner tx_fee to use for transaction(s). A number higher ' + 'than 1000 is used as "satoshi per KB" tx fee. A number lower than that ' + 'uses the dynamic fee estimation of your blockchain provider as ' + 'confirmation target. This temporarily overrides the "tx_fees" setting ' + 'in your joinmarket.cfg. Works the same way as described in it. Check ' + 'it for examples.') parser.add_option('--recoversync', action='store_true', dest='recoversync', diff --git a/scripts/sendpayment.py b/scripts/sendpayment.py index 7f37414..bd5502b 100644 --- a/scripts/sendpayment.py +++ b/scripts/sendpayment.py @@ -105,6 +105,10 @@ def main(): else: chooseOrdersFunc = options.order_choose_fn + # If tx_fees are set manually by CLI argument, override joinmarket.cfg: + if int(options.txfee) > 0: + jm_single().config.set("POLICY", "tx_fees", str(options.txfee)) + # Dynamically estimate a realistic fee if it currently is the default value. # At this point we do not know even the number of our own inputs, so # we guess conservatively with 2 inputs and 2 outputs each. diff --git a/scripts/tumbler.py b/scripts/tumbler.py index 6d8188c..f0604bb 100644 --- a/scripts/tumbler.py +++ b/scripts/tumbler.py @@ -114,6 +114,10 @@ def main(): tumble_log.info("With this schedule: ") tumble_log.info(pprint.pformat(schedule)) + # If tx_fees are set manually by CLI argument, override joinmarket.cfg: + if int(options['txfee']) > 0: + jm_single().config.set("POLICY", "tx_fees", str(options['txfee'])) + # Dynamically estimate an expected tx fee for the whole tumbling run. # This is very rough: we guess with 2 inputs and 2 outputs each. if options['txfee'] == -1: