Skip to content

Commit

Permalink
Merge pull request #4260 from BitGo/BTC-855-fix-unsafe-nonwitness-psb…
Browse files Browse the repository at this point in the history
…t-update

fix(utxo-lib): correct logic for unsafe segwit unspent update
  • Loading branch information
davidkaplanbitgo authored Feb 6, 2024
2 parents a599366 + a4839b9 commit 62bd8c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/utxo-lib/src/bitgo/wallet/Unspent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export function updateWalletUnspentForPsbt(
// with the previous transaction. Therefore, we can treat Zcash non-segwit transactions as Bitcoin
// segwit transactions
const isZcashOrSegwit = isSegwit(u.chain) || getMainnet(psbt.network) === networks.zcash;
if ((isZcashOrSegwit && !input.witnessUtxo) || customParams?.skipNonWitnessUtxo) {
if ((isZcashOrSegwit || customParams?.skipNonWitnessUtxo) && !input.witnessUtxo) {
const { script, value } = toPrevOutput(u, psbt.network);
psbt.updateInput(inputIndex, { witnessUtxo: { script, value } });
} else if (!isZcashOrSegwit) {
Expand Down

0 comments on commit 62bd8c8

Please sign in to comment.