feat(wasm-utxo): redesign PSBT signing API for clarity and performance #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a comprehensive redesign of the PSBT signing API to improve
clarity and performance, along with benchmarking tools to measure the impact.
Changes
performance implications
resulting in 2x performance improvement
types and input counts
New WASM API (backward compatible)
is_musig2_input(index)- Check if input is MuSig2 keypathsign_all_wallet_inputs(xpriv)- Bulk sign ECDSA/Schnorr script pathsign_wallet_input(index, xpriv)- Single input with save/restoresign_musig2_input(index, xpriv)- Single MuSig2 inputsign_all_musig2_inputs(xpriv)- Bulk MuSig2 with SighashCache reusesign_replay_protection_inputs(ecpair)- Bulk replay protectionPerformance Improvements
MuSig2 bulk signing now shows ~4.5ms per input (down from ~9.5ms),
representing a 2x improvement by reusing the SighashCache.
BTC-2980