zeroconf: Announce the channel with the real scid as well as aliases
With zeroconf we have to duplicate the `local_channel_announcement` since we locally announce the aliased version, and then on the first confirmation we also add the funding scid version.
This commit is contained in:
parent
29157735fb
commit
db61b048a9
|
@ -185,6 +185,16 @@ struct peer {
|
|||
/* We allow a 'tx-sigs' message between reconnect + funding_locked */
|
||||
bool tx_sigs_allowed;
|
||||
|
||||
/* Have we announced the real scid with a
|
||||
* local_channel_announcement? This can be different from the
|
||||
* `channel_local_active` flag in case we are using zeroconf,
|
||||
* in which case we'll have announced the channels with the
|
||||
* two aliases (LOCAL and REMOTE) but not with the real scid
|
||||
* just yet. If we get a funding depth change, with a scid,
|
||||
* and the two flags not equal we know we have to announce the
|
||||
* channel with the real scid. */
|
||||
bool gossip_scid_announced;
|
||||
|
||||
/* Most recent channel_update message. */
|
||||
u8 *channel_update;
|
||||
};
|
||||
|
@ -535,6 +545,14 @@ static void channel_announcement_negotiate(struct peer *peer)
|
|||
if (!peer->channel_local_active) {
|
||||
peer->channel_local_active = true;
|
||||
make_channel_local_active(peer);
|
||||
} else if(!peer->gossip_scid_announced) {
|
||||
/* So we know a short_channel_id, i.e., a point on
|
||||
* chain, but haven't added it to our local view of
|
||||
* the gossip yet. We need to add it now (and once
|
||||
* only), so our `channel_update` we'll send a couple
|
||||
* of lines down has something to attach to. */
|
||||
peer->gossip_scid_announced = true;
|
||||
make_channel_local_active(peer);
|
||||
}
|
||||
|
||||
/* BOLT #7:
|
||||
|
@ -3984,6 +4002,7 @@ int main(int argc, char *argv[])
|
|||
peer->have_sigs[LOCAL] = peer->have_sigs[REMOTE] = false;
|
||||
peer->announce_depth_reached = false;
|
||||
peer->channel_local_active = false;
|
||||
peer->gossip_scid_announced = false;
|
||||
peer->from_master = msg_queue_new(peer, true);
|
||||
peer->shutdown_sent[LOCAL] = false;
|
||||
peer->shutdown_wrong_funding = NULL;
|
||||
|
|
|
@ -1301,7 +1301,6 @@ def test_zeroconf_open(bitcoind, node_factory):
|
|||
l2.rpc.pay(inv)
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True, reason="Peers do not recognize the final scid yet")
|
||||
def test_zeroconf_public(bitcoind, node_factory):
|
||||
"""Test that we transition correctly from zeroconf to public
|
||||
|
||||
|
@ -1351,6 +1350,7 @@ def test_zeroconf_public(bitcoind, node_factory):
|
|||
bitcoind.generate_block(5)
|
||||
# Wait for l3 to learn about the channel, it'll have checked the
|
||||
# funding outpoint, scripts, etc.
|
||||
l3.connect(l1)
|
||||
wait_for(lambda: len(l3.rpc.listchannels()['channels']) == 2)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue