Browse Source

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>
ppa-0.6.1
Christian Decker 8 years ago
committed by Rusty Russell
parent
commit
896a67d1d6
  1. 6
      lightningd/peer_control.c

6
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. */ /* 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));

Loading…
Cancel
Save