@@ -117,6 +117,7 @@ The payjoin proposal MAY:
117
117
118
118
The payjoin proposal MUST NOT:
119
119
* Shuffle the order of inputs or outputs, the additional outputs or additional inputs must be inserted at a random index.
120
+ * Decrease the absolute fee of the original transaction.
120
121
121
122
===BIP21 payjoin parameters ===
122
123
@@ -249,6 +250,7 @@ The receiver needs to do some check on the original PSBT before proceeding:
249
250
250
251
The sender should check the payjoin proposal before signing it to prevent a malicious receiver from stealing money.
251
252
253
+ * Verify that the absolute fee of the payjoin proposal is equals or higher than the original PSBT.
252
254
* If the receiver's BIP21 signalled <code>pjos=0 </code>, disable payment output substitution.
253
255
* Verify that the transaction version, and the nLockTime are unchanged.
254
256
* Check that the sender's inputs' sequence numbers are unchanged.
@@ -529,6 +531,10 @@ public async Task<PSBT> RequestPayjoin(
529
531
if (sequences.Count != 1)
530
532
throw new PayjoinSenderException("Mixed sequence detected in the proposal");
531
533
534
+ decimal newFee = proposal.GetFee();
535
+ decimal additionalFee = newFee - originalFee;
536
+ if (additionalFee < 0)
537
+ throw new PayjoinSenderException("The receiver decreased absolute fee");
532
538
// For each outputs in the proposal:
533
539
foreach (PSBTOutput proposedPSBTOutput in proposal.Outputs)
534
540
{
@@ -545,8 +551,6 @@ public async Task<PSBT> RequestPayjoin(
545
551
// The amount that was substracted from the output's value is less or equal to maxadditionalfeecontribution
546
552
if (actualContribution > optionalParameters.MaxAdditionalFeeContribution)
547
553
throw new PayjoinSenderException("The actual contribution is more than maxadditionalfeecontribution");
548
- decimal newFee = proposal.GetFee();
549
- decimal additionalFee = newFee - originalFee;
550
554
// Make sure the actual contribution is only paying fee
551
555
if (actualContribution > additionalFee)
552
556
throw new PayjoinSenderException("The actual contribution is not only paying fee");
0 commit comments