rust-bitcoin / rust-bitcoin/rust-bitcoin

Taproot key spend and script spend hashes produced by `SighashCache` should be different types

Open
#3,236 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1.0 API break
Dominant language
Rust
Stars
2.7k
Forks
1k
Avg merge
4d 1h
Merged PRs (30d)
88

Description

Key spend goes to Witness as the only element (no hashing, no pushing of additional key...) so we should have Witness::p2tr_key_spend(signature: P2TrKeySpendSignature) -> Witness and to correctly map the hash to signature we need to remember that it's key spend. Script spend signatures are just pushed to Witness eventually finalized by pushing the script and control block so we need push_signature methods for those.

Also I think we can just have direct methods on SighashCache that do all the steps (hashing, producing signature, assigning singnature with key to witness/script_sig) for non-script signatures where you just provide the key.

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 by tracing the existing SighashCache and Witness APIs for Taproot key-spend and script-spend signatures. Compare how each spend type is hashed, represented, and added to the witness, then define completion as distinct types and appropriately scoped methods with coverage for both spend paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.