@@ -316,6 +316,7 @@ func TestP2pAntiflood_SetConsensusSizeNotifier(t *testing.T) {
316316
317317 wasCalled := false
318318 expectedSize := 878264
319+ testShardId := uint32 (5 )
319320 var actualSize int
320321 afm , _ := antiflood .NewP2PAntiflood (
321322 & mock.PeerBlackListHandlerStub {},
@@ -329,7 +330,7 @@ func TestP2pAntiflood_SetConsensusSizeNotifier(t *testing.T) {
329330 )
330331
331332 chainParamsSubscriber := chainparametersnotifier .NewChainParametersNotifier ()
332- afm .SetConsensusSizeNotifier (chainParamsSubscriber , 5 )
333+ afm .SetConsensusSizeNotifier (chainParamsSubscriber , testShardId )
333334
334335 chainParamsSubscriber .UpdateCurrentChainParameters (config.ChainParametersByEpochConfig {
335336 ShardConsensusGroupSize : uint32 (expectedSize ),
@@ -480,7 +481,15 @@ func TestP2pAntiflood_IsOriginatorEligibleForTopic(t *testing.T) {
480481func TestP2pAntiflood_ConcurrentOperations (t * testing.T ) {
481482 afm , _ := antiflood .NewP2PAntiflood (
482483 & mock.PeerBlackListHandlerStub {},
483- & mock.TopicAntiFloodStub {},
484+ & mock.TopicAntiFloodStub {
485+ IncreaseLoadCalled : func (pid core.PeerID , topic string , numMessages uint32 ) error {
486+ if topic == "should error" {
487+ return errors .New ("error" )
488+ }
489+
490+ return nil
491+ },
492+ },
484493 & mock.FloodPreventerStub {},
485494 )
486495
@@ -516,10 +525,12 @@ func TestP2pAntiflood_ConcurrentOperations(t *testing.T) {
516525 _ = afm .Debugger ()
517526 case 12 :
518527 _ = afm .SetPeerValidatorMapper (& mock.PeerShardResolverStub {})
528+ case 13 :
529+ _ = afm .CanProcessMessagesOnTopic ("peer" , "should error" , 37 , 39 , []byte ("sequence" ))
519530 }
520531
521532 wg .Done ()
522- }(i % 13 )
533+ }(i % 14 )
523534 }
524535
525536 wg .Wait ()
0 commit comments