Skip to content

Commit

Permalink
pay: ignore uncommited channels in listpeerchannels output
Browse files Browse the repository at this point in the history
Fixes ElementsProject#7197 - SEGV in direct_pay_listpeerchannels when field private missing

Changelog-Fixed: Fixed crash in pay plugin caused by parsing uncommitted dual open channels
  • Loading branch information
endothermicdev committed Apr 16, 2024
1 parent c4edec8 commit bf8737a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/libplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -2115,8 +2115,14 @@ static struct listpeers_channel *json_to_listpeers_channel(const tal_t *ctx,

json_to_node_id(buffer, idtok, &chan->id);
json_to_bool(buffer, conntok, &chan->connected);
json_to_bool(buffer, privtok, &chan->private);
if (privtok)
json_to_bool(buffer, privtok, &chan->private);
else
chan->private = true;
chan->state = json_strdup(chan, buffer, statetok);
if (streq(chan->state, "DUALOPEND_OPEN_INIT") ||
streq(chan->state, "OPENINGD"))
return tal_free(chan);
json_to_txid(buffer, ftxidtok, &chan->funding_txid);
if (scidtok != NULL) {
assert(dirtok != NULL);
Expand Down

0 comments on commit bf8737a

Please sign in to comment.