mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-19 21:14:38 +01:00
htlc: htlc_is_dead() helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user