File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -544,10 +544,16 @@ public async Task<PSBT> RequestPayjoin(
544
544
// Verify that no keypaths is in the PSBT output
545
545
if (proposedPSBTOutput.HDKeyPaths.Count != 0)
546
546
throw new PayjoinSenderException("The receiver added keypaths to an output");
547
- bool isOriginalOutput = originalOutputs.Count > 0 && originalOutputs.Peek().OriginalTxOut.ScriptPubKey == proposedPSBTOutput.ScriptPubKey;
548
- if (isOriginalOutput)
547
+ if (originalOutputs.Count == 0)
548
+ continue;
549
+ var originalOutput = originalOutputs.Peek();
550
+ bool isOriginalOutput = originalOutput.OriginalTxOut.ScriptPubKey == proposedPSBTOutput.ScriptPubKey;
551
+ bool substitutedOutput = !isOriginalOutput &&
552
+ allowOutputSubstitution &&
553
+ originalOutput.OriginalTxOut.ScriptPubKey == paymentScriptPubKey;
554
+ if (isOriginalOutput || substitutedOutput)
549
555
{
550
- var originalOutput = originalOutputs.Dequeue();
556
+ originalOutputs.Dequeue();
551
557
if (output.OriginalTxOut == feeOutput)
552
558
{
553
559
var actualContribution = feeOutput.Value - proposedPSBTOutput.Value;
You can’t perform that action at this time.
0 commit comments