mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-04 03:03:51 +01:00
htlcs: Wire up the forward statistics on HTLC updates
Signed-off-by: Christian Decker <@cdecker>
This commit is contained in:
parent
5b924a7eb7
commit
4b4c549c9d
1 changed files with 12 additions and 1 deletions
|
@ -722,8 +722,11 @@ static void fulfill_our_htlc_out(struct channel *channel, struct htlc_out *hout,
|
||||||
|
|
||||||
if (hout->am_origin)
|
if (hout->am_origin)
|
||||||
payment_succeeded(ld, hout, preimage);
|
payment_succeeded(ld, hout, preimage);
|
||||||
else if (hout->in)
|
else if (hout->in) {
|
||||||
fulfill_htlc(hout->in, preimage);
|
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,
|
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,
|
log_debug(channel->log, "Our HTLC %"PRIu64" failed (%u)", failed->id,
|
||||||
hout->failcode);
|
hout->failcode);
|
||||||
htlc_out_check(hout, __func__);
|
htlc_out_check(hout, __func__);
|
||||||
|
|
||||||
|
if (hout->in)
|
||||||
|
wallet_forwarded_payment_add(ld->wallet, hout->in, hout, FORWARD_FAILED);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,6 +969,10 @@ static bool update_out_htlc(struct channel *channel,
|
||||||
channel->dbid,
|
channel->dbid,
|
||||||
hout->msatoshi);
|
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 */
|
/* For our own HTLCs, we commit payment to db lazily */
|
||||||
if (hout->origin_htlc_id == 0)
|
if (hout->origin_htlc_id == 0)
|
||||||
payment_store(ld,
|
payment_store(ld,
|
||||||
|
|
Loading…
Add table
Reference in a new issue