Browse Source

htlcs: Wire up the forward statistics on HTLC updates

Signed-off-by: Christian Decker <@cdecker>
fee-tracking2
Christian Decker 6 years ago
parent
commit
4ef350d720
No known key found for this signature in database GPG Key ID: 1416D83DC4F0E86D
  1. 13
      lightningd/peer_htlcs.c

13
lightningd/peer_htlcs.c

@ -722,8 +722,11 @@ static void fulfill_our_htlc_out(struct channel *channel, struct htlc_out *hout,
if (hout->am_origin)
payment_succeeded(ld, hout, preimage);
else if (hout->in)
else if (hout->in) {
fulfill_htlc(hout->in, preimage);
wallet_forwarded_payment_add(ld->wallet, hout->in, hout,
FORWARD_SETTLED);
}
}
static bool peer_fulfilled_our_htlc(struct channel *channel,
@ -813,6 +816,10 @@ static bool peer_failed_our_htlc(struct channel *channel,
log_debug(channel->log, "Our HTLC %"PRIu64" failed (%u)", failed->id,
hout->failcode);
htlc_out_check(hout, __func__);
if (hout->in)
wallet_forwarded_payment_add(ld->wallet, hout->in, hout, FORWARD_FAILED);
return true;
}
@ -962,6 +969,10 @@ static bool update_out_htlc(struct channel *channel,
channel->dbid,
hout->msatoshi);
if (hout->in)
wallet_forwarded_payment_add(ld->wallet, hout->in, hout,
FORWARD_OFFERED);
/* For our own HTLCs, we commit payment to db lazily */
if (hout->origin_htlc_id == 0)
payment_store(ld,

Loading…
Cancel
Save