mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
htlc: htlc_is_dead() helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
23f9c7c209
commit
7cd9272ba9
2 changed files with 9 additions and 7 deletions
|
@ -138,4 +138,11 @@ static inline size_t htlc_map_count(const struct htlc_map *htlcs)
|
|||
{
|
||||
return htlcs->raw.elems;
|
||||
}
|
||||
|
||||
/* FIXME: Move these out of the hash! */
|
||||
static inline bool htlc_is_dead(const struct htlc *htlc)
|
||||
{
|
||||
return htlc->state == RCVD_REMOVE_ACK_REVOCATION
|
||||
|| htlc->state == SENT_REMOVE_ACK_REVOCATION;
|
||||
}
|
||||
#endif /* LIGHTNING_DAEMON_HTLC_H */
|
||||
|
|
|
@ -313,11 +313,7 @@ static bool committed_to_htlcs(const struct peer *peer)
|
|||
for (h = htlc_map_first(&peer->htlcs, &it);
|
||||
h;
|
||||
h = htlc_map_next(&peer->htlcs, &it)) {
|
||||
/* FIXME: Move these dead ones to a separate hash (or
|
||||
* just leave in database only). */
|
||||
if (h->state == RCVD_REMOVE_ACK_REVOCATION)
|
||||
continue;
|
||||
if (h->state == SENT_REMOVE_ACK_REVOCATION)
|
||||
if (htlc_is_dead(h))
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
|
@ -3156,8 +3152,7 @@ static void json_add_htlcs(struct json_result *response,
|
|||
continue;
|
||||
|
||||
/* Ignore completed HTLCs. */
|
||||
if (h->state == RCVD_REMOVE_ACK_REVOCATION
|
||||
|| h->state == SENT_REMOVE_ACK_REVOCATION)
|
||||
if (htlc_is_dead(h))
|
||||
continue;
|
||||
|
||||
json_object_start(response, NULL);
|
||||
|
|
Loading…
Add table
Reference in a new issue