Skip to content

Conversation

@Andezion
Copy link

(Fixes #8395)

Problem

When creating transactions, change outputs between 330-546 sat were being treated as dust and absorbed into fees. This caused users to overpay transaction fees.

The issue was that change_amount() function used chainparams->dust_limit (546 sat) for all output types, but P2TR and P2WPKH outputs have a lower dust limit of 330 sat according to Bitcoin Core standards.

Solution

Changed change_amount() in bitcoin/tx.c to use 330 sat dust limit for change outputs. This is correct because:

  • Change outputs are P2TR on Bitcoin mainnet
  • Change outputs are P2WPKH on Elements
  • Both types have 330 sat dust limit (not 546 sat like legacy P2PKH/P2SH)

Now change outputs between 330-546 sat are properly created instead of being absorbed into fees.

Testing

  • Added new test test_p2tr_change_dust.py that verifies change outputs in 330-546 sat range are created
  • Existing tests still pass: test_fundpsbt, test_withdraw_misc

Important

26.04 FREEZE March 11th: Non-bugfix PRs not ready by this date will wait for 26.06.

RC1 is scheduled on March 23rd

The final release is scheduled for April 15th.

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.
  • Important All PRs must consider how to reverse any persistent changes for tools/lightning-downgrade

Fixes ElementsProject#8395
Changelog-Fixed: Transactions now correctly create change outputs between 330-546 sat for P2TR/P2WPKH instead of absorbing them as fees
Fixes ElementsProject#8395
Changelog-Fixed: Transactions now correctly create change outputs between 330-546 sat for P2TR/P2WPKH instead of absorbing them as fees
@Andezion Andezion force-pushed the fix-p2tr-dust-limit branch from 7397c92 to 55c14f8 Compare December 23, 2025 13:43
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.

P2TR change outputs between 330 and 546 sat should not be absorbed into tx fees

1 participant