mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
staticbackup: don't use wireaddr_internal.
This is an internal type: it has no API guarantees (indeed, I'm about to change it, which is how I discovered scb was using it). Fortunately for every case we care about, it is actually a wireaddr (in theory the peer can connect locally using a local socket, but this is mostly for testing and is a very strange setup, and so simply don't do scb for those). In this case, the wire encoding is a single byte followed by the wireaddr, so open-code that in scb_wire.csv for compatibility. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user