test_lightningd: Check payment fields of pay return value.

This commit is contained in:
ZmnSCPxj 2018-03-14 11:55:19 +00:00 committed by Rusty Russell
parent 881eb80f6a
commit 6391645b83

View File

@ -926,10 +926,16 @@ class LightningDTests(BaseLightningDTests):
inv = l2.rpc.invoice(123000, 'test_pay', 'description')['bolt11']
before = int(time.time())
preimage = l1.rpc.pay(inv)
details = l1.rpc.pay(inv)
after = int(time.time())
invoice = l2.rpc.listinvoices('test_pay')['invoices'][0]
preimage = details['payment_preimage']
assert details['status'] == 'complete'
assert details['msatoshi'] == 123000
assert details['destination'] == l2.info['id']
assert details['created_at'] >= before
assert details['created_at'] <= after
invoice = l2.rpc.listinvoices('test_pay')['invoices'][0]
assert invoice['status'] == 'paid'
assert invoice['paid_at'] >= before
assert invoice['paid_at'] <= after
@ -957,7 +963,7 @@ class LightningDTests(BaseLightningDTests):
# Test listpayments indexed by bolt11.
assert len(l1.rpc.listpayments(inv)['payments']) == 1
assert l1.rpc.listpayments(inv)['payments'][0]['payment_preimage'] == preimage['payment_preimage']
assert l1.rpc.listpayments(inv)['payments'][0]['payment_preimage'] == preimage
def test_pay_optional_args(self):
l1, l2 = self.connect()