mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
lightningd: note whether payment secret is used or not.
This will allow nodes (with log-level=debug) to gather how many payments are made without payment_secrets. We need to know this so we know when we can make them compulsory. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
cd5a93d0bd
commit
ae4139ba10
2 changed files with 7 additions and 2 deletions
|
@ -182,10 +182,11 @@ void htlc_set_add(struct lightningd *ld,
|
|||
}
|
||||
|
||||
log_debug(ld->log,
|
||||
"HTLC set contains %zu HTLCs, for a total of %s out of %s",
|
||||
"HTLC set contains %zu HTLCs, for a total of %s out of %s (%spayment_secret)",
|
||||
tal_count(set->htlcs),
|
||||
type_to_string(tmpctx, struct amount_msat, &set->so_far),
|
||||
type_to_string(tmpctx, struct amount_msat, &total_msat)
|
||||
type_to_string(tmpctx, struct amount_msat, &total_msat),
|
||||
payment_secret ? "" : "no "
|
||||
);
|
||||
|
||||
if (amount_msat_eq(set->so_far, total_msat)) {
|
||||
|
|
|
@ -2440,6 +2440,7 @@ def test_pay_no_secret(node_factory, bitcoind):
|
|||
inv_nosecret = 'lnbcrt1u1pwue4vapp5ve584t0cv27hwmy0cx9ca8uwyqyfw9y9dm3r8vus9fv36r2l9yjsdqaw3jhxazlwpshjhmwda0hxetrwfjhgxq8pmnt9qqcqp9570xsjyykvssa6ty8fjth6f2y8h09myngad9utesttwjwclv95fz3lgd402f9e5yzpnxmkypg55rkvpg522gcz4ymsjl2w3m4jhw4jsp55m7tl'
|
||||
# This succeeds until we make secrets compulsory.
|
||||
l1.rpc.pay(inv_nosecret)
|
||||
l2.daemon.wait_for_log(r'HTLC set contains 1 HTLCs, for a total of 100000msat out of 100000msat \(no payment_secret\)')
|
||||
|
||||
|
||||
@flaky
|
||||
|
@ -2695,12 +2696,15 @@ def test_partial_payment_timeout(node_factory, bitcoind):
|
|||
|
||||
with pytest.raises(RpcError, match=r'WIRE_MPP_TIMEOUT'):
|
||||
l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=70 + TIMEOUT // 4, partid=1)
|
||||
l2.daemon.wait_for_log(r'HTLC set contains 1 HTLCs, for a total of 500msat out of 1000msat \(payment_secret\)')
|
||||
|
||||
# We can still pay it normally.
|
||||
l1.rpc.sendpay(route=route, payment_hash=inv['payment_hash'], msatoshi=1000, bolt11=inv['bolt11'], payment_secret=paysecret, partid=1)
|
||||
l1.rpc.sendpay(route=route, payment_hash=inv['payment_hash'], msatoshi=1000, bolt11=inv['bolt11'], payment_secret=paysecret, partid=2)
|
||||
l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=TIMEOUT, partid=1)
|
||||
l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=TIMEOUT, partid=2)
|
||||
l2.daemon.wait_for_log(r'HTLC set contains 1 HTLCs, for a total of 500msat out of 1000msat \(payment_secret\)')
|
||||
l2.daemon.wait_for_log(r'HTLC set contains 2 HTLCs, for a total of 1000msat out of 1000msat \(payment_secret\)')
|
||||
|
||||
|
||||
def test_partial_payment_restart(node_factory, bitcoind):
|
||||
|
|
Loading…
Add table
Reference in a new issue