mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
zeroconf: Wire the aliases through channeld
This commit is contained in:
parent
de1c0b51f0
commit
b9817d395f
@ -617,9 +617,15 @@ static void handle_peer_funding_locked(struct peer *peer, const u8 *msg)
|
||||
|
||||
peer->tx_sigs_allowed = false;
|
||||
peer->funding_locked[REMOTE] = true;
|
||||
if (tlvs->alias != NULL) {
|
||||
status_debug(
|
||||
"Peer told us that they'll use alias=%s for this channel",
|
||||
type_to_string(tmpctx, struct short_channel_id,
|
||||
tlvs->alias));
|
||||
}
|
||||
wire_sync_write(MASTER_FD,
|
||||
take(towire_channeld_got_funding_locked(NULL,
|
||||
&peer->remote_per_commit)));
|
||||
take(towire_channeld_got_funding_locked(
|
||||
NULL, &peer->remote_per_commit, tlvs->alias)));
|
||||
|
||||
channel_announcement_negotiate(peer);
|
||||
billboard_update(peer);
|
||||
@ -3208,12 +3214,14 @@ skip_tlvs:
|
||||
static void handle_funding_depth(struct peer *peer, const u8 *msg)
|
||||
{
|
||||
u32 depth;
|
||||
struct short_channel_id *scid;
|
||||
struct short_channel_id *scid, *alias_local;
|
||||
struct tlv_funding_locked_tlvs *tlvs;
|
||||
|
||||
if (!fromwire_channeld_funding_depth(tmpctx,
|
||||
msg,
|
||||
&scid,
|
||||
&depth))
|
||||
msg,
|
||||
&scid,
|
||||
&alias_local,
|
||||
&depth))
|
||||
master_badmsg(WIRE_CHANNELD_FUNDING_DEPTH, msg);
|
||||
|
||||
/* Too late, we're shutting down! */
|
||||
@ -3235,8 +3243,8 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
|
||||
peer->next_index[LOCAL],
|
||||
type_to_string(tmpctx, struct pubkey,
|
||||
&peer->next_local_per_commit));
|
||||
struct tlv_funding_locked_tlvs *tlvs =
|
||||
tlv_funding_locked_tlvs_new(tmpctx);
|
||||
tlvs = tlv_funding_locked_tlvs_new(tmpctx);
|
||||
tlvs->alias = alias_local;
|
||||
|
||||
msg = towire_funding_locked(
|
||||
NULL, &peer->channel_id,
|
||||
|
@ -85,8 +85,11 @@ msgdata,channeld_init,channel_update_len,u16,
|
||||
msgdata,channeld_init,channel_update,u8,channel_update_len
|
||||
|
||||
# master->channeld funding hit new depth(funding locked if >= lock depth)
|
||||
# alias != NULL if zeroconf and short_channel_id == NULL
|
||||
# short_channel_id != NULL once we have 3+ confirmations
|
||||
msgtype,channeld_funding_depth,1002
|
||||
msgdata,channeld_funding_depth,short_channel_id,?short_channel_id,
|
||||
msgdata,channeld_funding_depth,alias_local,?short_channel_id,
|
||||
msgdata,channeld_funding_depth,depth,u32,
|
||||
|
||||
# Tell channel to offer this htlc
|
||||
@ -117,6 +120,7 @@ msgdata,channeld_fail_htlc,failed_htlc,failed_htlc,
|
||||
# When we receive funding_locked.
|
||||
msgtype,channeld_got_funding_locked,1019
|
||||
msgdata,channeld_got_funding_locked,next_per_commit_point,pubkey,
|
||||
msgdata,channeld_got_funding_locked,alias,?short_channel_id,
|
||||
|
||||
#include <common/penalty_base.h>
|
||||
|
||||
|
Can't render this file because it has a wrong number of fields in line 14.
|
@ -230,9 +230,10 @@ bool channel_on_funding_locked(struct channel *channel,
|
||||
static void peer_got_funding_locked(struct channel *channel, const u8 *msg)
|
||||
{
|
||||
struct pubkey next_per_commitment_point;
|
||||
struct short_channel_id *alias_remote;
|
||||
|
||||
if (!fromwire_channeld_got_funding_locked(msg,
|
||||
&next_per_commitment_point)) {
|
||||
if (!fromwire_channeld_got_funding_locked(tmpctx,
|
||||
msg, &next_per_commitment_point, &alias_remote)) {
|
||||
channel_internal_error(channel,
|
||||
"bad channel_got_funding_locked %s",
|
||||
tal_hex(channel, msg));
|
||||
@ -242,11 +243,13 @@ static void peer_got_funding_locked(struct channel *channel, const u8 *msg)
|
||||
if (!channel_on_funding_locked(channel, &next_per_commitment_point))
|
||||
return;
|
||||
|
||||
if (channel->alias[REMOTE] == NULL)
|
||||
channel->alias[REMOTE] = tal_steal(channel, alias_remote);
|
||||
|
||||
/* Remember that we got the lockin */
|
||||
wallet_channel_save(channel->peer->ld->wallet, channel);
|
||||
if (channel->scid)
|
||||
lockin_complete(channel);
|
||||
else
|
||||
/* Remember that we got the lockin */
|
||||
wallet_channel_save(channel->peer->ld->wallet, channel);
|
||||
}
|
||||
|
||||
static void peer_got_announcement(struct channel *channel, const u8 *msg)
|
||||
@ -823,8 +826,8 @@ bool channel_tell_depth(struct lightningd *ld,
|
||||
}
|
||||
|
||||
subd_send_msg(channel->owner,
|
||||
take(towire_channeld_funding_depth(NULL, channel->scid,
|
||||
depth)));
|
||||
take(towire_channeld_funding_depth(
|
||||
NULL, channel->scid, channel->alias[LOCAL], depth)));
|
||||
|
||||
if (channel->remote_funding_locked
|
||||
&& channel->state == CHANNELD_AWAITING_LOCKIN
|
||||
|
Loading…
Reference in New Issue
Block a user