Fix browser PSBT prevout attachment - #96
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a16d712e4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const nonWitnessUtxo = hexToBytes(rawTransactionHex); | ||
| const previousTransactionHash = | ||
| syscoinUtils.bitcoinjs.crypto.hash256(nonWitnessUtxo); |
There was a problem hiding this comment.
Strip witnesses from injected fetcher results
When exportPsbtWithPrevouts is called by the sponsorship flow, api/services/sponsor-wallet.ts:410-415 injects fetchBackendRawTx rather than the new same-origin proxy, so a witness-bearing parent is still returned with its witness serialization. Hashing those bytes here computes the wtxid instead of the input's txid, causing the comparison below to reject valid SegWit prevouts and preventing sponsored UTXO burns from being prepared. Preserve the previous parse-and-strip behavior for custom fetchers, or route this caller through a fetcher that guarantees witness-stripped hex.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7423bc6. The browser now parses and witness-strips every raw parent response before hashing and attachment, including injected sponsorship fetchers. Buffer 6 is pinned so that bitcoinjs-lib v7 parsing and serialization are supported in the client bundle.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Reported reproduction
Verified against Tanenbaum parent transaction
575befd47b4effe268e967fc08d93163ecc81616b49970971dd8c0df93ed1a3d: txid validation, witness stripping, PSBT attachment, and browser-polyfill serialization all succeed.Verification
yarn test --runInBand(169 tests)yarn build