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 @@ -541,10 +541,16 @@ public async Task<PSBT> RequestPayjoin(
541
541
// Verify that no keypaths is in the PSBT output
542
542
if (proposedPSBTOutput.HDKeyPaths.Count != 0)
543
543
throw new PayjoinSenderException("The receiver added keypaths to an output");
544
- bool isOriginalOutput = originalOutputs.Count > 0 && originalOutputs.Peek().OriginalTxOut.ScriptPubKey == proposedPSBTOutput.ScriptPubKey;
545
- if (isOriginalOutput)
544
+ if (originalOutputs.Count == 0)
545
+ continue;
546
+ var originalOutput = originalOutputs.Peek();
547
+ bool isOriginalOutput = originalOutput.OriginalTxOut.ScriptPubKey == proposedPSBTOutput.ScriptPubKey;
548
+ bool substitutedOutput = !isOriginalOutput &&
549
+ allowOutputSubstitution &&
550
+ originalOutput.OriginalTxOut.ScriptPubKey == paymentScriptPubKey;
551
+ if (isOriginalOutput || substitutedOutput)
546
552
{
547
- var originalOutput = originalOutputs.Dequeue();
553
+ originalOutputs.Dequeue();
548
554
if (output.OriginalTxOut == feeOutput)
549
555
{
550
556
var actualContribution = feeOutput.Value - proposedPSBTOutput.Value;
You can’t perform that action at this time.
0 commit comments