Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject miniblocks which are not whitelisted #2021

Merged
merged 5 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions process/interceptors/multiDataInterceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (mdi *MultiDataInterceptor) ProcessReceivedMessage(message p2p.MessageP2P,
message.SeqNo(),
)
if err != nil {
mdi.throttler.EndProcessing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return err
}

Expand Down
11 changes: 2 additions & 9 deletions process/interceptors/processor/miniblockInterceptorProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,9 @@ func (mip *MiniblockInterceptorProcessor) Save(data process.InterceptedData, _ c

go mip.notify(miniblock, interceptedMiniblock.Hash(), topic)

shouldRejectMiniBlock := mip.isMbCrossShard(miniblock) &&
!mip.whiteListHandler.IsWhiteListed(data)
if shouldRejectMiniBlock {
if !mip.whiteListHandler.IsWhiteListed(data) {
log.Trace(
"miniblock interceptor processor : cross shard miniblock for me",
"message", "not whitelisted will not be added in pool",
"MiniblockInterceptorProcessor.Save: not whitelisted miniblocks will not be added in pool",
"type", miniblock.Type,
"sender", miniblock.SenderShardID,
"receiver", miniblock.ReceiverShardID,
Expand All @@ -115,10 +112,6 @@ func (mip *MiniblockInterceptorProcessor) RegisterHandler(handler func(topic str
mip.mutHandlers.Unlock()
}

func (mip *MiniblockInterceptorProcessor) isMbCrossShard(miniblock *block.MiniBlock) bool {
return miniblock.SenderShardID != mip.shardCoordinator.SelfId()
}

// IsInterfaceNil returns true if there is no value under the interface
func (mip *MiniblockInterceptorProcessor) IsInterfaceNil() bool {
return mip == nil
Expand Down