Skip to content

Commit

Permalink
feat(main): Print channel status when loading it from DB
Browse files Browse the repository at this point in the history
I was trying to debug a node with several multiplexed channels, and
was finding it a bit difficult to determine which channel index
matches which result of `listpeerchannels` as well as figuring out
what their status was. This just prints the status in string format
when loading the channel from the DB.

Changelog-Changed: wallet: The channel status is printed when loading it from the DB
  • Loading branch information
cdecker committed May 29, 2024
1 parent 43f4e12 commit 4de271f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions wallet/test/run-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ void channel_gossip_update(struct channel *channel UNNEEDED)
/* Generated stub for channel_scid_or_local_alias */
struct short_channel_id channel_scid_or_local_alias(const struct channel *chan UNNEEDED)
{ fprintf(stderr, "channel_scid_or_local_alias called!\n"); abort(); }
/* Generated stub for channel_state_name */
const char *channel_state_name(const struct channel *channel UNNEEDED)
{ fprintf(stderr, "channel_state_name called!\n"); abort(); }
/* Generated stub for connect_htlc_in */
void connect_htlc_in(struct htlc_in_map *map UNNEEDED, struct htlc_in *hin UNNEEDED)
{ fprintf(stderr, "connect_htlc_in called!\n"); abort(); }
Expand Down
4 changes: 3 additions & 1 deletion wallet/wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -3194,7 +3194,9 @@ bool wallet_htlcs_load_in_for_channel(struct wallet *wallet,
bool ok = true;
int incount = 0;

log_debug(wallet->log, "Loading in HTLCs for channel %"PRIu64, chan->dbid);
log_debug(wallet->log,
"Loading in HTLCs for channel %"PRIu64" (state=%s)",
chan->dbid, channel_state_name(chan));
stmt = db_prepare_v2(wallet->db, SQL("SELECT"
" id"
", channel_htlc_id"
Expand Down

0 comments on commit 4de271f

Please sign in to comment.