Browse Source

Merge #897: Fix additionalfeeoutputindex check in BIP78

c70f253 add test case for low feerate (Adam Gibson)
15089fc Fix additionalfeeoutputindex check in BIP78 (Adam Gibson)
master
Adam Gibson 5 years ago
parent
commit
df4bf2867d
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 4
      jmclient/jmclient/payjoin.py
  2. 10
      jmclient/test/test_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

10
jmclient/test/test_payjoin.py

@ -145,6 +145,16 @@ class TrialTestPayjoin3(PayjoinTestBase, unittest.TestCase):
self.wallet_structure = [3, 1, 0, 0, 0] self.wallet_structure = [3, 1, 0, 0, 0]
return self.do_test_payment(SegwitWallet, SegwitWallet, amt=4.5) return self.do_test_payment(SegwitWallet, SegwitWallet, amt=4.5)
class TrialTestPayjoin4(PayjoinTestBase, unittest.TestCase):
def reset_fee(self, res):
jm_single().config.set("POLICY", "txfees", self.old_txfees)
def test_low_feerate(self):
self.old_txfees = jm_single().config.get("POLICY", "tx_fees")
jm_single().config.set("POLICY", "tx_fees", "1300")
d = self.do_test_payment(SegwitWallet, SegwitWallet)
d.addCallback(self.reset_fee)
return d
def bip78_receiver_response(response, manager): def bip78_receiver_response(response, manager):
d = readBody(response) d = readBody(response)
# if the response code is not 200 OK, we must assume payjoin # if the response code is not 200 OK, we must assume payjoin

Loading…
Cancel
Save