diff --git a/common/scb_wire.csv b/common/scb_wire.csv index f27667caf..6410ff494 100644 --- a/common/scb_wire.csv +++ b/common/scb_wire.csv @@ -10,10 +10,12 @@ subtype,scb_chan subtypedata,scb_chan,id,u64, subtypedata,scb_chan,cid,channel_id, subtypedata,scb_chan,node_id,node_id, -subtypedata,scb_chan,addr,wireaddr_internal, +subtypedata,scb_chan,unused,u8, +subtypedata,scb_chan,addr,wireaddr, subtypedata,scb_chan,funding,bitcoin_outpoint, subtypedata,scb_chan,funding_sats,amount_sat, subtypedata,scb_chan,type,channel_type, + msgtype,static_chan_backup,6135, msgdata,static_chan_backup,version,u64, msgdata,static_chan_backup,timestamp,u32, diff --git a/lightningd/channel.c b/lightningd/channel.c index 6c02905e4..0c21fddcc 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -411,14 +411,20 @@ struct channel *new_channel(struct peer *peer, u64 dbid, channel->owner = NULL; memset(&channel->billboard, 0, sizeof(channel->billboard)); channel->billboard.transient = tal_strdup(channel, transient_billboard); - channel->scb = tal(channel, struct scb_chan); - channel->scb->id = dbid; - channel->scb->addr = peer->addr; - channel->scb->node_id = peer->id; - channel->scb->funding = *funding; - channel->scb->cid = *cid; - channel->scb->funding_sats = funding_sats; - channel->scb->type = channel_type_dup(channel->scb, type); + + /* If it's a unix domain socket connection, we don't save it */ + if (peer->addr.itype == ADDR_INTERNAL_WIREADDR) { + channel->scb = tal(channel, struct scb_chan); + channel->scb->id = dbid; + channel->scb->unused = 0; + channel->scb->addr = peer->addr.u.wireaddr; + channel->scb->node_id = peer->id; + channel->scb->funding = *funding; + channel->scb->cid = *cid; + channel->scb->funding_sats = funding_sats; + channel->scb->type = channel_type_dup(channel->scb, type); + } else + channel->scb = NULL; if (!log) { channel->log = new_log(channel, diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 4708578cb..260118ea6 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1261,13 +1261,17 @@ wallet_commit_channel(struct lightningd *ld, &commitment_feerate); channel->min_possible_feerate = commitment_feerate; channel->max_possible_feerate = commitment_feerate; - channel->scb = tal(channel, struct scb_chan); - channel->scb->id = channel->dbid; - channel->scb->addr = channel->peer->addr; - channel->scb->node_id = channel->peer->id; - channel->scb->funding = *funding; - channel->scb->cid = channel->cid; - channel->scb->funding_sats = total_funding; + if (channel->peer->addr.itype == ADDR_INTERNAL_WIREADDR) { + channel->scb = tal(channel, struct scb_chan); + channel->scb->id = channel->dbid; + channel->scb->unused = 0; + channel->scb->addr = channel->peer->addr.u.wireaddr; + channel->scb->node_id = channel->peer->id; + channel->scb->funding = *funding; + channel->scb->cid = channel->cid; + channel->scb->funding_sats = total_funding; + } else + channel->scb = NULL; channel->type = channel_type_dup(channel, type); channel->scb->type = channel_type_dup(channel->scb, type); diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index dece107cb..602721191 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -1309,7 +1309,7 @@ static struct channel *stub_chan(struct command *cmd, struct node_id nodeid, struct channel_id cid, struct bitcoin_outpoint funding, - struct wireaddr_internal addr, + struct wireaddr addr, struct amount_sat funding_sats, struct channel_type *type) { @@ -1342,10 +1342,14 @@ static struct channel *stub_chan(struct command *cmd, return NULL; } } else { + struct wireaddr_internal wint; + + wint.itype = ADDR_INTERNAL_WIREADDR; + wint.u.wireaddr = addr; peer = new_peer(cmd->ld, 0, &nodeid, - &addr, + &wint, false); }