recovery: save last_known_addr for peer if we know it.

This is more useful than the last address, which may be it connecting
to us.  And use it when we restore it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-11-24 12:11:16 +10:30
parent 22a481fbaa
commit ff290b19c9
2 changed files with 4 additions and 1 deletions

View file

@ -487,6 +487,9 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
channel->scb = tal(channel, struct scb_chan);
channel->scb->id = dbid;
channel->scb->unused = 0;
/* More useful to have last_known_addr, if avail */
if (peer->last_known_addr)
channel->scb->addr = *peer->last_known_addr;
channel->scb->addr = peer->addr.u.wireaddr.wireaddr;
channel->scb->node_id = peer->id;
channel->scb->funding = *funding;

View file

@ -1493,7 +1493,7 @@ static struct channel *stub_chan(struct command *cmd,
0,
&nodeid,
&wint,
NULL,
&addr,
NULL,
false);
}