channeld: exit after shutdown when no more HTLCs.

Ready for the introduction of closingd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-07-04 10:17:32 +09:30
parent 80886cda8a
commit 6fa90c926a
6 changed files with 129 additions and 5 deletions

View File

@@ -792,6 +792,21 @@ bool channel_awaiting_revoke_and_ack(const struct channel *channel)
return false;
}
bool channel_has_htlcs(const struct channel *channel)
{
struct htlc_map_iter it;
const struct htlc *htlc;
for (htlc = htlc_map_first(&channel->htlcs, &it);
htlc;
htlc = htlc_map_next(&channel->htlcs, &it)) {
/* FIXME: Clean these out! */
if (!htlc_is_dead(htlc))
return true;
}
return false;
}
static bool adjust_balance(struct channel *channel, struct htlc *htlc)
{
enum side side;