discovery: send both local and remote anns in the same goroutine
This commit changes the sending of anns from using separate goroutines to always sending both local and remote announcements in the same goroutine. In addition, the local announcements are always sent first. This change is to fix the following case: 1. Alice and Bob have a channel 2. Alice receives Bob's NodeAnnouncement 3. Alice goes to broadcast the channel 4. The broadcast is split into a local and remote broadcast due to PR #7239. Bob's NodeAnnouncement is in the remote batch. Everything else (ChannelAnnouncement, ChannelUpdate x2, and Alice's NodeAnnouncement) is in the local batch. 5. The remote batch (containing Bob's NodeAnnouncement) runs before the local batch since they are spawned in separate goroutines. This means that Alice sends Carol the NodeAnnouncement before Carol knows of the channel. In step 2), Bob's NodeAnnouncement (isRemote = true) replaces Bob's NodeAnnouncement that Alice was going to relay (isRemote = false) after processing the AnnouncementSignatures.
This commit is contained in:
2 files changed
+39
-28
No files matched your search
@@ -784,7 +784,7 @@ func createTestCtx(t *testing.T, startHeight uint32) (*testCtx, error) {
|
||||
HistoricalSyncTicker: ticker.NewForce(DefaultHistoricalSyncInterval),
|
||||
NumActiveSyncers: 3,
|
||||
AnnSigner: &mock.SingleSigner{Privkey: selfKeyPriv},
|
||||
SubBatchDelay: time.Second * 5,
|
||||
SubBatchDelay: 1 * time.Millisecond,
|
||||
MinimumBatchSize: 10,
|
||||
MaxChannelUpdateBurst: DefaultMaxChannelUpdateBurst,
|
||||
ChannelUpdateInterval: DefaultChannelUpdateInterval,
|
||||
@@ -3371,7 +3371,9 @@ out:
|
||||
case <-sentMsgs:
|
||||
case err := <-notifyErr:
|
||||
t.Fatal(err)
|
||||
default:
|
||||
|
||||
// Give it 5 seconds to drain out.
|
||||
case <-time.After(5 * time.Second):
|
||||
break out
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user