#9262 introduced -walletrejectlongchains
, which prevents the wallet from adding transactions which would form a chain which is too long to be accepted by the mempool. However, it’s set to false by default.
There are legitimate reasons for wanting the wallet to accept longer chains than the mempool, and #9290 does ensure that wallet transactions will be resubmitted to the mempool eventually. However, in the mainline case the behaviour is confusing for the user and the wallet should reject the long chains. See for instance #10004 and #9752.
This PR sets -walletrejectlongchains
to true by default, and makes the wallet reject transactions that form a chain up to (maxlength - 1). This means that the user has one final chance to add a transaction to the chain by restarting with -walletrejectlongchains
set to false. This could be helpful if a user wants to use CPFP to unstick a transaction package with too low fees.
Tests also updated to verify new behaviour.
This PR also changes the error message returned if Coin Selection fails. Currently, if Coin Selection fails, then the error returned to the user is “Insufficient Funds”. This is misleading as Coin Selection can fail for other reasons, such as if the transaction would form a chain that is too long to enter the mempool. This commit changes the error message returned from “Insufficient Funds” to “Coin Selection Failed” and updates the test scripts to expect the correct error message.