From 4b4c549c9d5d89a9cd059e6121863545e7fbba90 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 17 Oct 2018 00:16:50 +0200 Subject: [PATCH] htlcs: Wire up the forward statistics on HTLC updates Signed-off-by: Christian Decker <@cdecker> --- lightningd/peer_htlcs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index aada3470a..9315a3588 100644 --- a/lightningd/peer_htlcs.c +++ b/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,