@@ -100,22 +100,22 @@ func TestAccessManRestrictedSlots(t *testing.T) {
100
100
a , err := newAccessMan (cfg )
101
101
require .NoError (t , err )
102
102
103
- // Check that the peerCounts map is correctly populated with three
103
+ // Check that the peerChanInfo map is correctly populated with three
104
104
// peers.
105
105
require .Equal (t , 0 , int (a .numRestricted ))
106
- require .Equal (t , 3 , len (a .peerCounts ))
106
+ require .Equal (t , 3 , len (a .peerChanInfo ))
107
107
108
- peerCount1 , ok := a .peerCounts [peerKeySer1 ]
108
+ peerCount1 , ok := a .peerChanInfo [peerKeySer1 ]
109
109
require .True (t , ok )
110
110
require .True (t , peerCount1 .HasOpenOrClosedChan )
111
111
require .Equal (t , peer1PendingCount , int (peerCount1 .PendingOpenCount ))
112
112
113
- peerCount2 , ok := a .peerCounts [peerKeySer2 ]
113
+ peerCount2 , ok := a .peerChanInfo [peerKeySer2 ]
114
114
require .True (t , ok )
115
115
require .True (t , peerCount2 .HasOpenOrClosedChan )
116
116
require .Equal (t , peer2PendingCount , int (peerCount2 .PendingOpenCount ))
117
117
118
- peerCount3 , ok := a .peerCounts [peerKeySer3 ]
118
+ peerCount3 , ok := a .peerChanInfo [peerKeySer3 ]
119
119
require .True (t , ok )
120
120
require .False (t , peerCount3 .HasOpenOrClosedChan )
121
121
require .Equal (t , peer3PendingCount , int (peerCount3 .PendingOpenCount ))
@@ -144,7 +144,7 @@ func TestAccessManRestrictedSlots(t *testing.T) {
144
144
145
145
// Assert that accessman's internal state is updated with peer4. We
146
146
// expect this new peer to have 1 pending open count.
147
- peerCount4 , ok := a .peerCounts [string (peerKey4 .SerializeCompressed ())]
147
+ peerCount4 , ok := a .peerChanInfo [string (peerKey4 .SerializeCompressed ())]
148
148
require .True (t , ok )
149
149
require .False (t , peerCount4 .HasOpenOrClosedChan )
150
150
require .Equal (t , 1 , int (peerCount4 .PendingOpenCount ))
@@ -157,7 +157,7 @@ func TestAccessManRestrictedSlots(t *testing.T) {
157
157
// Assert that accessman's internal state is updated with peer3. We
158
158
// expect this existing peer to decrement its pending open count and the
159
159
// flag `HasOpenOrClosedChan` should be true.
160
- peerCount3 , ok = a .peerCounts [peerKeySer3 ]
160
+ peerCount3 , ok = a .peerChanInfo [peerKeySer3 ]
161
161
require .True (t , ok )
162
162
require .True (t , peerCount3 .HasOpenOrClosedChan )
163
163
require .Equal (t , peer3PendingCount - 1 , int (peerCount3 .PendingOpenCount ))
@@ -175,7 +175,7 @@ func TestAccessManRestrictedSlots(t *testing.T) {
175
175
require .ErrorIs (t , err , ErrNoMoreRestrictedAccessSlots )
176
176
177
177
// Assert that peer4 is removed.
178
- _ , ok = a .peerCounts [string (peerKey4 .SerializeCompressed ())]
178
+ _ , ok = a .peerChanInfo [string (peerKey4 .SerializeCompressed ())]
179
179
require .False (t , ok )
180
180
}
181
181
@@ -434,7 +434,7 @@ func TestAssignPeerPermsBypassExisting(t *testing.T) {
434
434
return peerPriv .PubKey ()
435
435
}
436
436
437
- // peer1 exists in `peerCounts ` map.
437
+ // peer1 exists in `peerChanInfo ` map.
438
438
peer1 := genPeerPub ()
439
439
peer1Str := string (peer1 .SerializeCompressed ())
440
440
@@ -494,27 +494,27 @@ func TestHasPeer(t *testing.T) {
494
494
495
495
// Create a testing accessMan.
496
496
a := & accessMan {
497
- peerCounts : make (map [string ]channeldb.ChanCount ),
498
- peerScores : make (map [string ]peerSlotStatus ),
497
+ peerChanInfo : make (map [string ]channeldb.ChanCount ),
498
+ peerScores : make (map [string ]peerSlotStatus ),
499
499
}
500
500
501
501
// peer1 exists with an open channel.
502
502
peer1 := "peer1"
503
- a .peerCounts [peer1 ] = channeldb.ChanCount {
503
+ a .peerChanInfo [peer1 ] = channeldb.ChanCount {
504
504
HasOpenOrClosedChan : true ,
505
505
}
506
506
peer1Access := peerStatusProtected
507
507
508
508
// peer2 exists with a pending channel.
509
509
peer2 := "peer2"
510
- a .peerCounts [peer2 ] = channeldb.ChanCount {
510
+ a .peerChanInfo [peer2 ] = channeldb.ChanCount {
511
511
PendingOpenCount : 1 ,
512
512
}
513
513
peer2Access := peerStatusTemporary
514
514
515
515
// peer3 exists without any channels.
516
516
peer3 := "peer3"
517
- a .peerCounts [peer3 ] = channeldb.ChanCount {}
517
+ a .peerChanInfo [peer3 ] = channeldb.ChanCount {}
518
518
peer3Access := peerStatusRestricted
519
519
520
520
// peer4 exists with a score.
@@ -560,8 +560,8 @@ func TestAddPeerAccessInbound(t *testing.T) {
560
560
561
561
// Create a testing accessMan.
562
562
a := & accessMan {
563
- peerCounts : make (map [string ]channeldb.ChanCount ),
564
- peerScores : make (map [string ]peerSlotStatus ),
563
+ peerChanInfo : make (map [string ]channeldb.ChanCount ),
564
+ peerScores : make (map [string ]peerSlotStatus ),
565
565
}
566
566
567
567
// Create a testing key.
@@ -579,7 +579,7 @@ func TestAddPeerAccessInbound(t *testing.T) {
579
579
// taken, and this peer is not found in the counts map.
580
580
require .Len (t , a .peerScores , 1 )
581
581
require .Equal (t , int64 (1 ), a .numRestricted )
582
- require .NotContains (t , a .peerCounts , pubStr )
582
+ require .NotContains (t , a .peerChanInfo , pubStr )
583
583
584
584
// The peer should be found in the score map.
585
585
score , ok := a .peerScores [pubStr ]
@@ -594,12 +594,12 @@ func TestAddPeerAccessInbound(t *testing.T) {
594
594
// Assert the internal state is not changed.
595
595
require .Len (t , a .peerScores , 1 )
596
596
require .Equal (t , int64 (1 ), a .numRestricted )
597
- require .NotContains (t , a .peerCounts , pubStr )
597
+ require .NotContains (t , a .peerChanInfo , pubStr )
598
598
599
599
// Reset the accessMan.
600
600
a = & accessMan {
601
- peerCounts : make (map [string ]channeldb.ChanCount ),
602
- peerScores : make (map [string ]peerSlotStatus ),
601
+ peerChanInfo : make (map [string ]channeldb.ChanCount ),
602
+ peerScores : make (map [string ]peerSlotStatus ),
603
603
}
604
604
605
605
// Add this peer as an inbound peer with peerStatusTemporary.
@@ -613,8 +613,8 @@ func TestAddPeerAccessInbound(t *testing.T) {
613
613
require .Equal (t , int64 (0 ), a .numRestricted )
614
614
615
615
// NOTE: in reality this is not possible as the peer must have been put
616
- // into the map `peerCounts ` before its perm can be upgraded.
617
- require .NotContains (t , a .peerCounts , pubStr )
616
+ // into the map `peerChanInfo ` before its perm can be upgraded.
617
+ require .NotContains (t , a .peerChanInfo , pubStr )
618
618
619
619
// The peer should be found in the score map.
620
620
score , ok = a .peerScores [pubStr ]
@@ -631,8 +631,8 @@ func TestAddPeerAccessOutbound(t *testing.T) {
631
631
632
632
// Create a testing accessMan.
633
633
a := & accessMan {
634
- peerCounts : make (map [string ]channeldb.ChanCount ),
635
- peerScores : make (map [string ]peerSlotStatus ),
634
+ peerChanInfo : make (map [string ]channeldb.ChanCount ),
635
+ peerScores : make (map [string ]peerSlotStatus ),
636
636
}
637
637
638
638
// Create a testing key.
@@ -650,7 +650,7 @@ func TestAddPeerAccessOutbound(t *testing.T) {
650
650
// taken, and this peer is found in the counts map.
651
651
require .Len (t , a .peerScores , 1 )
652
652
require .Equal (t , int64 (0 ), a .numRestricted )
653
- require .Contains (t , a .peerCounts , pubStr )
653
+ require .Contains (t , a .peerChanInfo , pubStr )
654
654
655
655
// The peer should be found in the score map.
656
656
score , ok := a .peerScores [pubStr ]
@@ -661,7 +661,7 @@ func TestAddPeerAccessOutbound(t *testing.T) {
661
661
require .Equal (t , expecedScore , score )
662
662
663
663
// The peer should be found in the peer counts map.
664
- count , ok := a .peerCounts [pubStr ]
664
+ count , ok := a .peerChanInfo [pubStr ]
665
665
require .True (t , ok )
666
666
667
667
// The peer's count should be initialized correctly.
@@ -674,12 +674,12 @@ func TestAddPeerAccessOutbound(t *testing.T) {
674
674
// Assert the internal state is not changed.
675
675
require .Len (t , a .peerScores , 1 )
676
676
require .Equal (t , int64 (0 ), a .numRestricted )
677
- require .Contains (t , a .peerCounts , pubStr )
677
+ require .Contains (t , a .peerChanInfo , pubStr )
678
678
679
679
// Reset the accessMan.
680
680
a = & accessMan {
681
- peerCounts : make (map [string ]channeldb.ChanCount ),
682
- peerScores : make (map [string ]peerSlotStatus ),
681
+ peerChanInfo : make (map [string ]channeldb.ChanCount ),
682
+ peerScores : make (map [string ]peerSlotStatus ),
683
683
}
684
684
685
685
// Add this peer as an inbound peer with peerStatusTemporary.
@@ -693,8 +693,8 @@ func TestAddPeerAccessOutbound(t *testing.T) {
693
693
require .Equal (t , int64 (0 ), a .numRestricted )
694
694
695
695
// NOTE: in reality this is not possible as the peer must have been put
696
- // into the map `peerCounts ` before its perm can be upgraded.
697
- require .NotContains (t , a .peerCounts , pubStr )
696
+ // into the map `peerChanInfo ` before its perm can be upgraded.
697
+ require .NotContains (t , a .peerChanInfo , pubStr )
698
698
699
699
// The peer should be found in the score map.
700
700
score , ok = a .peerScores [pubStr ]
0 commit comments