@@ -765,7 +765,7 @@ func createTestCtx(t *testing.T, startHeight uint32) (*testCtx, error) {
765765 peerChan chan <- lnpeer.Peer ) {
766766
767767 pk , _ := btcec .ParsePubKey (target [:])
768- peerChan <- & mockPeer {pk , nil , nil }
768+ peerChan <- & mockPeer {pk , nil , nil , atomic. Bool {} }
769769 },
770770 NotifyWhenOffline : func (_ [33 ]byte ) <- chan struct {} {
771771 c := make (chan struct {})
@@ -843,7 +843,7 @@ func TestProcessAnnouncement(t *testing.T) {
843843 }
844844 }
845845
846- nodePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
846+ nodePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil , atomic. Bool {} }
847847
848848 // First, we'll craft a valid remote channel announcement and send it to
849849 // the gossiper so that it can be processed.
@@ -953,7 +953,7 @@ func TestPrematureAnnouncement(t *testing.T) {
953953 _ , err = createNodeAnnouncement (remoteKeyPriv1 , timestamp )
954954 require .NoError (t , err , "can't create node announcement" )
955955
956- nodePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
956+ nodePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil , atomic. Bool {} }
957957
958958 // Pretending that we receive the valid channel announcement from
959959 // remote side, but block height of this announcement is greater than
@@ -990,7 +990,9 @@ func TestSignatureAnnouncementLocalFirst(t *testing.T) {
990990 pk , _ := btcec .ParsePubKey (target [:])
991991
992992 select {
993- case peerChan <- & mockPeer {pk , sentMsgs , ctx .gossiper .quit }:
993+ case peerChan <- & mockPeer {
994+ pk , sentMsgs , ctx .gossiper .quit , atomic.Bool {},
995+ }:
994996 case <- ctx .gossiper .quit :
995997 }
996998 }
@@ -1000,7 +1002,9 @@ func TestSignatureAnnouncementLocalFirst(t *testing.T) {
10001002
10011003 remoteKey , err := btcec .ParsePubKey (batch .nodeAnn2 .NodeID [:])
10021004 require .NoError (t , err , "unable to parse pubkey" )
1003- remotePeer := & mockPeer {remoteKey , sentMsgs , ctx .gossiper .quit }
1005+ remotePeer := & mockPeer {
1006+ remoteKey , sentMsgs , ctx .gossiper .quit , atomic.Bool {},
1007+ }
10041008
10051009 // Recreate lightning network topology. Initialize router with channel
10061010 // between two nodes.
@@ -1162,7 +1166,9 @@ func TestOrphanSignatureAnnouncement(t *testing.T) {
11621166 pk , _ := btcec .ParsePubKey (target [:])
11631167
11641168 select {
1165- case peerChan <- & mockPeer {pk , sentMsgs , ctx .gossiper .quit }:
1169+ case peerChan <- & mockPeer {
1170+ pk , sentMsgs , ctx .gossiper .quit , atomic.Bool {},
1171+ }:
11661172 case <- ctx .gossiper .quit :
11671173 }
11681174 }
@@ -1172,7 +1178,9 @@ func TestOrphanSignatureAnnouncement(t *testing.T) {
11721178
11731179 remoteKey , err := btcec .ParsePubKey (batch .nodeAnn2 .NodeID [:])
11741180 require .NoError (t , err , "unable to parse pubkey" )
1175- remotePeer := & mockPeer {remoteKey , sentMsgs , ctx .gossiper .quit }
1181+ remotePeer := & mockPeer {
1182+ remoteKey , sentMsgs , ctx .gossiper .quit , atomic.Bool {},
1183+ }
11761184
11771185 // Pretending that we receive local channel announcement from funding
11781186 // manager, thereby kick off the announcement exchange process, in
@@ -1344,7 +1352,9 @@ func TestSignatureAnnouncementRetryAtStartup(t *testing.T) {
13441352
13451353 // Set up a channel to intercept the messages sent to the remote peer.
13461354 sentToPeer := make (chan lnwire.Message , 1 )
1347- remotePeer := & mockPeer {remoteKey , sentToPeer , ctx .gossiper .quit }
1355+ remotePeer := & mockPeer {
1356+ remoteKey , sentToPeer , ctx .gossiper .quit , atomic.Bool {},
1357+ }
13481358
13491359 // Since the reliable send to the remote peer of the local channel proof
13501360 // requires a notification when the peer comes online, we'll capture the
@@ -1578,7 +1588,9 @@ func TestSignatureAnnouncementFullProofWhenRemoteProof(t *testing.T) {
15781588 // Set up a channel we can use to inspect messages sent by the
15791589 // gossiper to the remote peer.
15801590 sentToPeer := make (chan lnwire.Message , 1 )
1581- remotePeer := & mockPeer {remoteKey , sentToPeer , ctx .gossiper .quit }
1591+ remotePeer := & mockPeer {
1592+ remoteKey , sentToPeer , ctx .gossiper .quit , atomic.Bool {},
1593+ }
15821594
15831595 // Override NotifyWhenOnline to return the remote peer which we expect
15841596 // meesages to be sent to.
@@ -1772,7 +1784,7 @@ func TestDeDuplicatedAnnouncements(t *testing.T) {
17721784 ca , err := createRemoteChannelAnnouncement (0 )
17731785 require .NoError (t , err , "can't create remote channel announcement" )
17741786
1775- nodePeer := & mockPeer {bitcoinKeyPub2 , nil , nil }
1787+ nodePeer := & mockPeer {bitcoinKeyPub2 , nil , nil , atomic. Bool {} }
17761788 announcements .AddMsgs (networkMsg {
17771789 msg : ca ,
17781790 peer : nodePeer ,
@@ -2058,7 +2070,7 @@ func TestForwardPrivateNodeAnnouncement(t *testing.T) {
20582070 // process it.
20592071 remoteChanAnn , err := createRemoteChannelAnnouncement (startingHeight - 1 )
20602072 require .NoError (t , err , "unable to create remote channel announcement" )
2061- peer := & mockPeer {pubKey , nil , nil }
2073+ peer := & mockPeer {pubKey , nil , nil , atomic. Bool {} }
20622074
20632075 select {
20642076 case err := <- ctx .gossiper .ProcessRemoteAnnouncement (remoteChanAnn , peer ):
@@ -2373,7 +2385,9 @@ func TestReceiveRemoteChannelUpdateFirst(t *testing.T) {
23732385 // Set up a channel that we can use to inspect the messages sent
23742386 // directly from the gossiper.
23752387 sentMsgs := make (chan lnwire.Message , 10 )
2376- remotePeer := & mockPeer {remoteKey , sentMsgs , ctx .gossiper .quit }
2388+ remotePeer := & mockPeer {
2389+ remoteKey , sentMsgs , ctx .gossiper .quit , atomic.Bool {},
2390+ }
23772391
23782392 // Override NotifyWhenOnline to return the remote peer which we expect
23792393 // messages to be sent to.
@@ -2561,7 +2575,9 @@ func TestExtraDataChannelAnnouncementValidation(t *testing.T) {
25612575 ctx , err := createTestCtx (t , 0 )
25622576 require .NoError (t , err , "can't create context" )
25632577
2564- remotePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
2578+ remotePeer := & mockPeer {
2579+ remoteKeyPriv1 .PubKey (), nil , nil , atomic.Bool {},
2580+ }
25652581
25662582 // We'll now create an announcement that contains an extra set of bytes
25672583 // that we don't know of ourselves, but should still include in the
@@ -2592,7 +2608,9 @@ func TestExtraDataChannelUpdateValidation(t *testing.T) {
25922608 ctx , err := createTestCtx (t , 0 )
25932609 require .NoError (t , err , "can't create context" )
25942610
2595- remotePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
2611+ remotePeer := & mockPeer {
2612+ remoteKeyPriv1 .PubKey (), nil , nil , atomic.Bool {},
2613+ }
25962614
25972615 // In this scenario, we'll create two announcements, one regular
25982616 // channel announcement, and another channel update announcement, that
@@ -2643,7 +2661,9 @@ func TestExtraDataNodeAnnouncementValidation(t *testing.T) {
26432661 ctx , err := createTestCtx (t , 0 )
26442662 require .NoError (t , err , "can't create context" )
26452663
2646- remotePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
2664+ remotePeer := & mockPeer {
2665+ remoteKeyPriv1 .PubKey (), nil , nil , atomic.Bool {},
2666+ }
26472667 timestamp := testTimestamp
26482668
26492669 // We'll create a node announcement that includes a set of opaque data
@@ -2716,7 +2736,7 @@ func TestRetransmit(t *testing.T) {
27162736
27172737 remoteKey , err := btcec .ParsePubKey (batch .nodeAnn2 .NodeID [:])
27182738 require .NoError (t , err , "unable to parse pubkey" )
2719- remotePeer := & mockPeer {remoteKey , nil , nil }
2739+ remotePeer := & mockPeer {remoteKey , nil , nil , atomic. Bool {} }
27202740
27212741 // Process a local channel announcement, channel update and node
27222742 // announcement. No messages should be broadcasted yet, since no proof
@@ -2822,7 +2842,7 @@ func TestNodeAnnouncementNoChannels(t *testing.T) {
28222842
28232843 remoteKey , err := btcec .ParsePubKey (batch .nodeAnn2 .NodeID [:])
28242844 require .NoError (t , err , "unable to parse pubkey" )
2825- remotePeer := & mockPeer {remoteKey , nil , nil }
2845+ remotePeer := & mockPeer {remoteKey , nil , nil , atomic. Bool {} }
28262846
28272847 // Process the remote node announcement.
28282848 select {
@@ -2906,7 +2926,7 @@ func TestOptionalFieldsChannelUpdateValidation(t *testing.T) {
29062926
29072927 chanUpdateHeight := uint32 (0 )
29082928 timestamp := uint32 (123456 )
2909- nodePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
2929+ nodePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil , atomic. Bool {} }
29102930
29112931 // In this scenario, we'll test whether the message flags field in a
29122932 // channel update is properly handled.
@@ -3013,7 +3033,9 @@ func TestSendChannelUpdateReliably(t *testing.T) {
30133033 // Set up a channel we can use to inspect messages sent by the
30143034 // gossiper to the remote peer.
30153035 sentToPeer := make (chan lnwire.Message , 1 )
3016- remotePeer := & mockPeer {remoteKey , sentToPeer , ctx .gossiper .quit }
3036+ remotePeer := & mockPeer {
3037+ remoteKey , sentToPeer , ctx .gossiper .quit , atomic.Bool {},
3038+ }
30173039
30183040 // Since we first wait to be notified of the peer before attempting to
30193041 // send the message, we'll overwrite NotifyWhenOnline and
@@ -3367,7 +3389,9 @@ func TestPropagateChanPolicyUpdate(t *testing.T) {
33673389 remoteKey := remoteKeyPriv1 .PubKey ()
33683390
33693391 sentMsgs := make (chan lnwire.Message , 10 )
3370- remotePeer := & mockPeer {remoteKey , sentMsgs , ctx .gossiper .quit }
3392+ remotePeer := & mockPeer {
3393+ remoteKey , sentMsgs , ctx .gossiper .quit , atomic.Bool {},
3394+ }
33713395
33723396 // The forced code path for sending the private ChannelUpdate to the
33733397 // remote peer will be hit, forcing it to request a notification that
@@ -3715,7 +3739,9 @@ func TestBroadcastAnnsAfterGraphSynced(t *testing.T) {
37153739
37163740 t .Helper ()
37173741
3718- nodePeer := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
3742+ nodePeer := & mockPeer {
3743+ remoteKeyPriv1 .PubKey (), nil , nil , atomic.Bool {},
3744+ }
37193745 var errChan chan error
37203746 if isRemote {
37213747 errChan = ctx .gossiper .ProcessRemoteAnnouncement (
@@ -3791,7 +3817,9 @@ func TestRateLimitChannelUpdates(t *testing.T) {
37913817 batch , err := createRemoteAnnouncements (blockHeight )
37923818 require .NoError (t , err )
37933819
3794- nodePeer1 := & mockPeer {remoteKeyPriv1 .PubKey (), nil , nil }
3820+ nodePeer1 := & mockPeer {
3821+ remoteKeyPriv1 .PubKey (), nil , nil , atomic.Bool {},
3822+ }
37953823 select {
37963824 case err := <- ctx .gossiper .ProcessRemoteAnnouncement (
37973825 batch .chanAnn , nodePeer1 ,
@@ -3810,7 +3838,9 @@ func TestRateLimitChannelUpdates(t *testing.T) {
38103838 t .Fatal ("remote announcement not processed" )
38113839 }
38123840
3813- nodePeer2 := & mockPeer {remoteKeyPriv2 .PubKey (), nil , nil }
3841+ nodePeer2 := & mockPeer {
3842+ remoteKeyPriv2 .PubKey (), nil , nil , atomic.Bool {},
3843+ }
38143844 select {
38153845 case err := <- ctx .gossiper .ProcessRemoteAnnouncement (
38163846 batch .chanUpdAnn2 , nodePeer2 ,
@@ -3929,7 +3959,7 @@ func TestIgnoreOwnAnnouncement(t *testing.T) {
39293959
39303960 remoteKey , err := btcec .ParsePubKey (batch .nodeAnn2 .NodeID [:])
39313961 require .NoError (t , err , "unable to parse pubkey" )
3932- remotePeer := & mockPeer {remoteKey , nil , nil }
3962+ remotePeer := & mockPeer {remoteKey , nil , nil , atomic. Bool {} }
39333963
39343964 // Try to let the remote peer tell us about the channel we are part of.
39353965 select {
@@ -4075,7 +4105,7 @@ func TestRejectCacheChannelAnn(t *testing.T) {
40754105
40764106 remoteKey , err := btcec .ParsePubKey (batch .nodeAnn2 .NodeID [:])
40774107 require .NoError (t , err , "unable to parse pubkey" )
4078- remotePeer := & mockPeer {remoteKey , nil , nil }
4108+ remotePeer := & mockPeer {remoteKey , nil , nil , atomic. Bool {} }
40794109
40804110 // Before sending over the announcement, we'll modify it such that we
40814111 // know it will always fail.
0 commit comments