mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
channeld: always send either a temporary or final update if we can.
If we hit depth 6, we would start exchanging announcement signatures. However, we should still send a temporary update while waiting for the reply; make the logic clear in this case that we should always send one or the other. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
00d4c04208
commit
f92712f22c
@@ -504,30 +504,26 @@ static void channel_announcement_negotiate(struct peer *peer)
|
||||
if (!peer->funding_locked[LOCAL] || !peer->funding_locked[REMOTE])
|
||||
return;
|
||||
|
||||
/* If we haven't reached announce depth yet, we can only send
|
||||
* a local update */
|
||||
if (!peer->announce_depth_reached) {
|
||||
if (!peer->sent_temporary_announce) {
|
||||
peer->sent_temporary_announce = true;
|
||||
send_temporary_announcement(peer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* BOLT #7:
|
||||
*
|
||||
* If sent, `announcement_signatures` messages MUST NOT be sent until
|
||||
* `funding_locked` has been sent and the funding transaction has
|
||||
* at least 6 confirmations.
|
||||
*/
|
||||
if (!peer->have_sigs[LOCAL]) {
|
||||
if (peer->announce_depth_reached && !peer->have_sigs[LOCAL]) {
|
||||
send_announcement_signatures(peer);
|
||||
peer->have_sigs[LOCAL] = true;
|
||||
billboard_update(peer);
|
||||
}
|
||||
|
||||
/* If we've completed the signature exchange, we can send a real
|
||||
* announcement, otherwise we send a temporary one */
|
||||
if (peer->have_sigs[LOCAL] && peer->have_sigs[REMOTE])
|
||||
announce_channel(peer);
|
||||
else if (!peer->sent_temporary_announce) {
|
||||
peer->sent_temporary_announce = true;
|
||||
send_temporary_announcement(peer);
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_peer_funding_locked(struct peer *peer, const u8 *msg)
|
||||
|
||||
Reference in New Issue
Block a user