mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
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 <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
a668cb4f2b
commit
896a67d1d6
@@ -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. */
|
/* 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)
|
bool *tell_immediate)
|
||||||
{
|
{
|
||||||
struct htlc_out *hout;
|
struct htlc_out *hout;
|
||||||
@@ -1367,7 +1367,7 @@ static bool tell_if_missing(const struct peer *peer, size_t n,
|
|||||||
*tell_immediate = false;
|
*tell_immediate = false;
|
||||||
|
|
||||||
/* Is it a current HTLC? */
|
/* 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)
|
if (!hout)
|
||||||
return false;
|
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... */
|
/* FIXME: Don't queue all at once, use an empty cb... */
|
||||||
for (size_t i = 0; i < tal_count(stubs); i++) {
|
for (size_t i = 0; i < tal_count(stubs); i++) {
|
||||||
bool tell_immediate;
|
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],
|
msg = towire_onchain_htlc(peer, &stubs[i],
|
||||||
tell, tell_immediate);
|
tell, tell_immediate);
|
||||||
subd_send_msg(peer->owner, take(msg));
|
subd_send_msg(peer->owner, take(msg));
|
||||||
|
|||||||
Reference in New Issue
Block a user