wallet: Fix Taproot descriptor weight calculation #34386

pull tboy1337 wants to merge 1 commits into bitcoin:master from tboy1337:fix-tr-descriptor-weight changing 3 files +78 −17
  1. tboy1337 commented at 4:04 am on January 23, 2026: none

    Problem

    The MaxSatisfactionWeight method for Taproot descriptors was incorrectly assuming only keypath spends, leading to significant underestimations of transaction weight. This could cause fee estimation failures for Taproot descriptors with script paths that are more expensive than the key path.

    Solution

    • Fixed weight calculation: Updated MaxSatisfactionWeight to properly calculate the maximum weight across all Taproot script leaves, not just the key path

    Changes

    • src/script/descriptor.cpp: Implemented proper weight calculation that iterates through all descriptor leaves to find the maximum satisfaction weight
    • src/test/descriptor_tests.cpp: Added comprehensive test case descriptor_tr_max_satisfaction_weight covering various Taproot scenarios
    • test/functional/wallet_taproot.py: Updated tests to handle higher fee rates for complex script paths and improved assertions

    Testing

    • Added unit tests verifying correct weight calculation for Taproot descriptors with script paths heavier than key paths
    • Updated functional tests to use appropriate fee rates for edge cases involving large Taproot scripts
    • All existing tests continue to pass

    This fix ensures wallets can properly estimate fees for all Taproot spending scenarios, preventing transaction failures due to underestimated fees.

  2. DrahtBot added the label Wallet on Jan 23, 2026
  3. DrahtBot commented at 4:04 am on January 23, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34386.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  4. fanquake commented at 9:28 am on January 23, 2026: member
    Same as #34314?
  5. Fix Taproot descriptors and adjust weight calculation 06d07571f3
  6. tboy1337 force-pushed on Jan 23, 2026
  7. fanquake closed this on Jan 23, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-27 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me