Browse Source

Fix additionalfeeoutputindex check in BIP78

Before this commit, if the sender specified
the additionalfeeoutputindex as 0, the receiver
incorrectly treated this as meaning it could not
decrement the change value at all (treating zero
as false in Python `if`), meaning that the feerate
was reduced more than intended, or in extreme
cases, the payjoin fell back incorrectly because
the feerate fell below the specified minfeerate.
After this commit, the additionalfeeoutputindex
value specified by the sender is correctly used
by the receiver in all cases.
master
Adam Gibson 5 years ago
parent
commit
15089fcf53
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 4
      jmclient/jmclient/payjoin.py

4
jmclient/jmclient/payjoin.py

@ -735,7 +735,7 @@ class PayjoinConverter(object):
return (False, "Invalid request parameters.", return (False, "Invalid request parameters.",
"original-psbt-rejected") "original-psbt-rejected")
if afoi and not (self.manager.change_out_index == afoi): if afoi is not None and not (self.manager.change_out_index == afoi):
return (False, "additionalfeeoutputindex is " return (False, "additionalfeeoutputindex is "
"not the change output. Joinmarket does " "not the change output. Joinmarket does "
"not currently support this.", "not currently support this.",
@ -817,7 +817,7 @@ class PayjoinConverter(object):
# set the intended virtual size of our input: # set the intended virtual size of our input:
vsize = self.manager.get_vsize_for_input() vsize = self.manager.get_vsize_for_input()
our_fee_bump = 0 our_fee_bump = 0
if afoi: if afoi is not None:
# We plan to reduce the change_out by a fee contribution. # We plan to reduce the change_out by a fee contribution.
# Calculate the additional fee we think we need for our input, # Calculate the additional fee we think we need for our input,
# to keep the same feerate as the original transaction (this also # to keep the same feerate as the original transaction (this also

Loading…
Cancel
Save