Skip to content

Commit ce05941

Browse files
committed
wallet: don't show htlcs from closed channels in listhtlcs.
This doesn't happen yet, since we delete all HTLCs when we close a channel. But we're about to change that, so update the wallet_htlcs_first() code to avoid them. Signed-off-by: Rusty Russell <[email protected]>
1 parent 13c5db5 commit ce05941

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wallet/wallet.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6558,7 +6558,8 @@ struct wallet_htlc_iter *wallet_htlcs_first(const tal_t *ctx,
65586558
", h.updated_index"
65596559
" FROM channel_htlcs h"
65606560
" JOIN channels ON channels.id = h.channel_id"
6561-
" WHERE h.updated_index >= ?"
6561+
" WHERE channels.state != ?"
6562+
" AND h.updated_index >= ?"
65626563
" ORDER BY h.updated_index ASC"
65636564
" LIMIT ?;"));
65646565
} else {
@@ -6575,10 +6576,12 @@ struct wallet_htlc_iter *wallet_htlcs_first(const tal_t *ctx,
65756576
", h.updated_index"
65766577
" FROM channel_htlcs h"
65776578
" JOIN channels ON channels.id = h.channel_id"
6578-
" WHERE h.id >= ?"
6579+
" WHERE channels.state != ?"
6580+
" AND h.id >= ?"
65796581
" ORDER BY h.id ASC"
65806582
" LIMIT ?;"));
65816583
}
6584+
db_bind_int(i->stmt, channel_state_in_db(CLOSED));
65826585
}
65836586
db_bind_u64(i->stmt, liststart);
65846587
if (listlimit)

0 commit comments

Comments
 (0)