Skip to content

Commit 5e4cc6d

Browse files
committed
Fix grammar, additional note on ability to increase output of the receiver
1 parent feac3d0 commit 5e4cc6d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

bip-0078.mediawiki

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ This fee contribution can't be used to pay for anything else than additional inp
154154

155155
* <code>minfeerate=</code>, a decimal in satoshi per vbyte that the sender can use to constraint the receiver to not drop the minimum fee rate too much.
156156
157-
* <code>disableoutputsubstitution=</code>, a boolean indicating if the sender forbids the receiver to modify his own output, see [[#output-substitution|payment output substitution]]. (default to <code>false</code>)
157+
* <code>disableoutputsubstitution=</code>, a boolean indicating if the sender forbids the receiver to substitute the receiver's output, see [[#output-substitution|payment output substitution]]. (default to <code>false</code>)
158158
159159
===Receiver's well known errors===
160160

@@ -270,20 +270,20 @@ The sender should check the payjoin proposal before signing it to prevent a mali
270270
* For each outputs in the proposal:
271271
** Verify that no keypaths is in the PSBT output
272272
** If the output is the [[#fee-output|fee output]]:
273-
*** The amount that was substracted from the output's value is less or equal to <code>maxadditionalfeecontribution</code>. Let's call this amount <code>actual contribution</code>.
274-
*** Make sure the actual contribution is only paying fee: The <code>actual contribution</code> is less or equals to the difference of absolute fee between the payjoin proposal and the original PSBT.
275-
*** Make sure the actual contribution is only paying for fee incurred by additional inputs: <code>actual contribution</code> is less or equals to <code>originalPSBTFeeRate * vsize(sender_input_type) * (count(original_psbt_inputs) - count(payjoin_proposal_inputs))</code>. (see [[#fee-output|Fee output]] section)
273+
*** The amount that was substracted from the output's value is less than or equal to <code>maxadditionalfeecontribution</code>. Let's call this amount <code>actual contribution</code>.
274+
*** Make sure the actual contribution is only paying fee: The <code>actual contribution</code> is less than or equals to the difference of absolute fee between the payjoin proposal and the original PSBT.
275+
*** Make sure the actual contribution is only paying for fee incurred by additional inputs: <code>actual contribution</code> is less than or equals to <code>originalPSBTFeeRate * vsize(sender_input_type) * (count(original_psbt_inputs) - count(payjoin_proposal_inputs))</code>. (see [[#fee-output|Fee output]] section)
276276
** If the output is the payment output and payment output substitution is allowed.
277277
*** Do not make any check
278278
** Else
279-
*** Make sure the output's value did not decreased.
279+
*** Make sure the output's value did not decrease.
280280
** Verify that all sender's outputs (ie, all outputs except the output actually paid to the receiver) from the original PSBT are in the proposal.
281281
* Once the proposal is signed, if <code>minfeerate</code> was specified, check that the fee rate of the payjoin transaction is not less than this value.
282282
283283
The sender must be careful to only sign the inputs that were present in the original PSBT and nothing else.
284284

285285
Note:
286-
* The sender must allow the receiver to add/remove or modify the receiver's own outputs (if [[#output-substitution|payment output substitution]], the payment's output should not be modified)
286+
* The sender must allow the receiver to add/remove or modify the receiver's own outputs. (if payment output substitution is disabled, the receiver's outputs must not be removed or decreased in value)
287287
* The sender should allow the receiver to not add any inputs. This is useful for the receiver to change the paymout output scriptPubKey type.
288288
* If no input have been added, the sender's wallet implementation should accept the payjoin proposal, but not mark the transaction as an actual payjoin in the user interface.
289289
@@ -341,7 +341,9 @@ On top of this the receiver can poison analysis by randomly faking a round amoun
341341

342342
===<span id="output-substitution"></span>Payment output substitution===
343343

344-
The receiver is free to change the output paying to himself.
344+
Unless disallowed by sender explicitely via `disableoutputsubstitution=true` or by the BIP21 url via query parameter the `pjos=0`, the receiver is free to decrease the amount, remove, or change the scriptPubKey output paying to himself.
345+
Note that if payment output substitution is disallowed, the reveiver can still increase the amount of the output. (See [[#reference-impl|the reference implementation]])
346+
345347
For example, if the sender's scriptPubKey type is P2WPKH while the receiver's payment output in the original PSBT is P2SH, then the receiver can substitute the payment output to be P2WPKH to match the sender's scriptPubKey type.
346348

347349
===<span id="unsecured-payjoin"></span>Unsecured payjoin server===
@@ -402,7 +404,7 @@ Note that the sender can disallow [[#output-substitution|payment output substitu
402404

403405
With payjoin, the maximum amount of money that can be lost is equal to two payments.
404406

405-
==Reference sender's implementation==
407+
==<span id="reference-impl"></span>Reference sender's implementation==
406408

407409
Here is pseudo code of a sender implementation.
408410
<code>RequestPayjoin</code> takes the bip21 URI of the payment, the wallet and the <code>signedPSBT</code>.
@@ -548,7 +550,7 @@ public async Task<PSBT> RequestPayjoin(
548550
if (output.OriginalTxOut == feeOutput)
549551
{
550552
var actualContribution = feeOutput.Value - proposedPSBTOutput.Value;
551-
// The amount that was substracted from the output's value is less or equal to maxadditionalfeecontribution
553+
// The amount that was substracted from the output's value is less than or equal to maxadditionalfeecontribution
552554
if (actualContribution > optionalParameters.MaxAdditionalFeeContribution)
553555
throw new PayjoinSenderException("The actual contribution is more than maxadditionalfeecontribution");
554556
// Make sure the actual contribution is only paying fee

0 commit comments

Comments
 (0)