From 896a67d1d6f4dbfe38c38b39e31d58f881a4efa3 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 10 Oct 2017 19:46:23 +0200 Subject: [PATCH] peer: Pass in the htlc_stub directly to tell_if_missing No idea why we were iterating over the list of stubs and then passing in the index instead of a pointer to the stub directly. Signed-off-by: Christian Decker --- lightningd/peer_control.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index d66478d88..f1f2870fa 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1358,7 +1358,7 @@ static u8 *p2wpkh_for_keyidx(const tal_t *ctx, struct lightningd *ld, u64 keyidx } /* If we want to know if this HTLC is missing, return depth. */ -static bool tell_if_missing(const struct peer *peer, size_t n, +static bool tell_if_missing(const struct peer *peer, struct htlc_stub *stub, bool *tell_immediate) { struct htlc_out *hout; @@ -1367,7 +1367,7 @@ static bool tell_if_missing(const struct peer *peer, size_t n, *tell_immediate = false; /* Is it a current HTLC? */ - hout = find_htlc_out_by_ripemd(peer, &peer->htlcs[n].ripemd); + hout = find_htlc_out_by_ripemd(peer, &stub->ripemd); if (!hout) return false; @@ -1482,7 +1482,7 @@ static enum watch_result funding_spent(struct peer *peer, /* FIXME: Don't queue all at once, use an empty cb... */ for (size_t i = 0; i < tal_count(stubs); i++) { bool tell_immediate; - bool tell = tell_if_missing(peer, i, &tell_immediate); + bool tell = tell_if_missing(peer, &stubs[i], &tell_immediate); msg = towire_onchain_htlc(peer, &stubs[i], tell, tell_immediate); subd_send_msg(peer->owner, take(msg));