From c31ff0f0956c418ac80c9d847b2844e7d6e93b0c Mon Sep 17 00:00:00 2001 From: Patrick Lodder Date: Sat, 25 Sep 2021 20:01:34 +0200 Subject: [PATCH] wallet: change incremental fee for RBF Sets WALLET_INCREMENTAL_RELAY_FEE to 1/10th of the default recommended minimum fee, to encourage using RBF over CPFP and saving the additional blockspace required for child transactions spending parent transactions. The previous value was based off a 1 DOGE recommended fee and did not make sense with the current minimum fee recommendation. --- qa/rpc-tests/bumpfee.py | 12 ++++++------ src/wallet/wallet.h | 10 +++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/qa/rpc-tests/bumpfee.py b/qa/rpc-tests/bumpfee.py index 1b6feb1c1..65aea4508 100755 --- a/qa/rpc-tests/bumpfee.py +++ b/qa/rpc-tests/bumpfee.py @@ -202,7 +202,7 @@ def test_settxfee(rbf_node, dest_address): rbftx = rbf_node.gettransaction(rbfid) rbf_node.settxfee(Decimal("5.00000000")) bumped_tx = rbf_node.bumpfee(rbfid) - assert_equal(bumped_tx["fee"], abs(rbftx["fee"]) + Decimal("0.50000000")) + assert_equal(bumped_tx["fee"], abs(rbftx["fee"]) + Decimal("0.00100000")) rbf_node.settxfee(Decimal("0.00000000")) # unset paytxfee @@ -210,18 +210,18 @@ def test_rebumping(rbf_node, dest_address): # check that re-bumping the original tx fails, but bumping the bumper succeeds rbf_node.settxfee(Decimal("10.00000000")) rbfid = create_fund_sign_send(rbf_node, {dest_address: 8.00000000}) - bumped = rbf_node.bumpfee(rbfid, {"totalFee": 1050000000}) - assert_raises_jsonrpc(-4, "already bumped", rbf_node.bumpfee, rbfid, {"totalFee": 11000}) - rbf_node.bumpfee(bumped["txid"], {"totalFee": 1100000000}) + bumped = rbf_node.bumpfee(rbfid, {"totalFee": 1000100000}) + assert_raises_jsonrpc(-4, "already bumped", rbf_node.bumpfee, rbfid, {"totalFee": 1000100000}) + rbf_node.bumpfee(bumped["txid"], {"totalFee": 1000200000}) rbf_node.settxfee(Decimal("0.00000000")) def test_rebumping_not_replaceable(rbf_node, dest_address): # check that re-bumping a non-replaceable bump tx fails rbfid = create_fund_sign_send(rbf_node, {dest_address: 7.00000000}) - bumped = rbf_node.bumpfee(rbfid, {"totalFee": 150000000, "replaceable": False}) + bumped = rbf_node.bumpfee(rbfid, {"totalFee": 100100000, "replaceable": False}) assert_raises_jsonrpc(-4, "Transaction is not BIP 125 replaceable", rbf_node.bumpfee, bumped["txid"], - {"totalFee": 200000000}) + {"totalFee": 100200000}) def test_unconfirmed_not_spendable(rbf_node, rbf_node_address): diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 97157819b..f83695e6d 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -57,7 +57,15 @@ static const CAmount DEFAULT_FALLBACK_FEE = RECOMMENDED_MIN_TX_FEE; //! -mintxfee default static const CAmount DEFAULT_TRANSACTION_MINFEE = RECOMMENDED_MIN_TX_FEE; //! minimum recommended increment for BIP 125 replacement txs -static const CAmount WALLET_INCREMENTAL_RELAY_FEE = RECOMMENDED_MIN_TX_FEE * 50; +/* + * Dogecoin: Scaled to 1/10th of the recommended transaction fee to make RBF + * cheaper than CPFP. This reduces onchain pollution by encouraging transactions + * to be replaced in the mempool, rather than be respent by another transaction + * which then both would have to be mined, taking up block space and increasing + * the amount of data that needs to be synchronized when validating the chain. + * This way, replacements for fee bumps are transient rather than persisted. + */ +static const CAmount WALLET_INCREMENTAL_RELAY_FEE = RECOMMENDED_MIN_TX_FEE / 10; //! target minimum change amount static const CAmount MIN_CHANGE = RECOMMENDED_MIN_TX_FEE; //! final minimum change amount after paying for fees