Skip to content

Commit f66c827

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#24502: wallet: don't create long chains by default
da2bc86 [wallet] don't create long chains by default (glozow) Pull request description: Default mempool policy doesn't let you have chains longer than 25 transactions. This is locally configurable of course, but it's not really safe to assume that a chain longer than 25 transactions will propagate. Thus, the wallet should probably avoid creating such transactions by default; set `DEFAULT_WALLET_REJECT_LONG_CHAINS` to true. Closes #9752 Closes #10004 ACKs for top commit: MarcoFalke: re-ACK da2bc86 only change is fixing typos in tests 🎏 Tree-SHA512: 65d8e4ec437fe928adf554aa7e819a52e0599b403d5310895f4e371e99bbc838219b3097c4d2f775bc870ac617ef6b4227b94291f2b376f824f14e8f2b152f31
2 parents 9745e18 + da2bc86 commit f66c827

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static const CAmount WALLET_INCREMENTAL_RELAY_FEE = 5000;
9494
//! Default for -spendzeroconfchange
9595
static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true;
9696
//! Default for -walletrejectlongchains
97-
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS = false;
97+
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS{true};
9898
//! -txconfirmtarget default
9999
static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 6;
100100
//! -walletrbf default

test/functional/wallet_balance.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def set_test_params(self):
5050
self.num_nodes = 2
5151
self.setup_clean_chain = True
5252
self.extra_args = [
53-
['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool
53+
# Limit mempool descendants as a hack to have wallet txs rejected from the mempool.
54+
# Set walletrejectlongchains=0 so the wallet still creates the transactions.
55+
['-limitdescendantcount=3', '-walletrejectlongchains=0'],
5456
[],
5557
]
5658

test/functional/wallet_basic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class WalletTest(BitcoinTestFramework):
2525
def set_test_params(self):
2626
self.num_nodes = 4
2727
self.extra_args = [[
28-
"-acceptnonstdtxn=1",
28+
"-acceptnonstdtxn=1", "-walletrejectlongchains=0"
2929
]] * self.num_nodes
3030
self.setup_clean_chain = True
3131
self.supports_cli = False
@@ -142,7 +142,7 @@ def run_test(self):
142142
self.nodes[2].lockunspent(False, [unspent_0], True)
143143

144144
# Restarting the node with the lock written to the wallet should keep the lock
145-
self.restart_node(2)
145+
self.restart_node(2, ["-walletrejectlongchains=0"])
146146
assert_raises_rpc_error(-8, "Invalid parameter, output already locked", self.nodes[2].lockunspent, False, [unspent_0])
147147

148148
# Unloading and reloading the wallet with a persistent lock should keep the lock
@@ -568,7 +568,7 @@ def run_test(self):
568568
self.log.info("Test -reindex")
569569
self.stop_nodes()
570570
# set lower ancestor limit for later
571-
self.start_node(0, ['-reindex', "-limitancestorcount=" + str(chainlimit)])
571+
self.start_node(0, ['-reindex', "-walletrejectlongchains=0", "-limitancestorcount=" + str(chainlimit)])
572572
self.start_node(1, ['-reindex', "-limitancestorcount=" + str(chainlimit)])
573573
self.start_node(2, ['-reindex', "-limitancestorcount=" + str(chainlimit)])
574574
# reindex will leave rpc warm up "early"; Wait for it to finish

0 commit comments

Comments
 (0)