rust-bitcoin / rust-bitcoin/rust-miniscript

Inconsistent input size estimation from the planning module

Open
#701 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
426
Forks
200
Avg merge
7d 17h
Merged PRs (30d)
8

Description

plan() takes into account the leaf script + control block for Taproot but not the witness script for P2WSH. This results in getting the maximum witness size for the plan (witness_size()) sometimes taking into account the full satisfaction size (under Taproot) and sometimes not (under P2WSH), which is rather confusing.

As a hack we leveraged the explicit_script function to add the script size only under P2WSH since it returns None for Taproot: https://github.com/wizardsardine/liana/blob/bdc0b50ad9780ea29b77703c513a99fb5876fb21/src/descriptors/mod.rs#L261-L274

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the planning module's plan() and witness_size() paths, then inspect src/descriptors/mod.rs around explicit_script(), as referenced in the issue. Trace how Taproot and P2WSH satisfaction sizes are accounted for and add or update focused tests that demonstrate consistent maximum witness-size estimation for both descriptor types.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, cryptography
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.