Skip to content

Wallet: don't create transaction chains that will be rejected by mempool by default#1535

Open
tomt1664 wants to merge 2 commits intoElementsProject:elements-23.xfrom
tomt1664:fix-too-long-chain-error
Open

Wallet: don't create transaction chains that will be rejected by mempool by default#1535
tomt1664 wants to merge 2 commits intoElementsProject:elements-23.xfrom
tomt1664:fix-too-long-chain-error

Conversation

@tomt1664
Copy link
Member

Cherry pick of bitcoin/bitcoin#24502 with additional functional test to check rejection.

da2bc86 [wallet] don't create long chains by default (glozow)

Additional functional test for too-long-chains rejected.

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
@tomt1664 tomt1664 requested a review from delta1 February 27, 2026 12:11
Copy link
Member

@delta1 delta1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 6846eef; code review and tested locally

options = {"include_unsafe": True, 'add_inputs': True}
# Sending one more chained transaction will fail
options = {"include_unsafe": True, 'add_inputs': True}
assert_raises_rpc_error(-4, "Insufficient funds",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a better error message here but I see that's quite an invasive change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to apply a modified version of bitcoin/bitcoin#24845 - but it changes spend.cpp substantially, and will most likely cause issues for any future merges.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True but this PR is for elements-23.x branch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - it is unlikely (but possible) there will be future bug fixes that will need to go in here before support is discontinued.

Co-authored-by: Byron Hambly <byron@hambly.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants