Skip to content

rpc: add segwit and taproot support to sweepprivkeys#296

Open
kwsantiago wants to merge 1 commit intobitcoinknots:29.x-knotsfrom
privkeyio:fix-sweepprivkeys-segwit
Open

rpc: add segwit and taproot support to sweepprivkeys#296
kwsantiago wants to merge 1 commit intobitcoinknots:29.x-knotsfrom
privkeyio:fix-sweepprivkeys-segwit

Conversation

@kwsantiago
Copy link
Copy Markdown

Summary

  • sweepprivkeys only scanned for P2PKH and bare pubkey outputs, silently missing funds at P2WPKH, P2SH-P2WPKH, and P2TR addresses
  • Add all segwit/taproot output types to the UTXO needle set (compressed keys only, as segwit requires)
  • Add P2WPKH redeem script and taproot builder data to the signing provider
  • Pass PrecomputedTransactionData to the signature creator so BIP341 Schnorr signing works

Test plan

  • Existing legacy sweep tests pass
  • New test: sweep P2WPKH output
  • New test: sweep P2SH-P2WPKH output
  • New test: sweep P2TR output

sweepprivkeys only generated P2PKH and bare pubkey script needles,
silently missing funds at P2WPKH, P2SH-P2WPKH, and P2TR addresses.
Add all segwit output types to the UTXO scan, add the redeem script
and taproot builder data needed for signing, and pass precomputed
transaction data so Schnorr signatures work.
@kwsantiago kwsantiago force-pushed the fix-sweepprivkeys-segwit branch from b3d54ef to 641c223 Compare April 3, 2026 12:32
luke-jr pushed a commit that referenced this pull request Apr 13, 2026
sweepprivkeys only generated P2PKH and bare pubkey script needles,
silently missing funds at P2WPKH, P2SH-P2WPKH, and P2TR addresses.
Add all segwit output types to the UTXO scan, add the redeem script
and taproot builder data needed for signing, and pass precomputed
transaction data so Schnorr signatures work.

Github-Pull: #296
Rebased-From: 641c223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants