Pubsub: Ignore block already in database (#4721)

* Ignore block already in database
* Merge refs/heads/master into skip-block-already-in-db
This commit is contained in:
Preston Van Loon 2020-02-02 16:37:50 -08:00 committed by GitHub
parent 05876d6250
commit 397b7d807a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,10 @@ func (r *Service) beaconBlockSubscriber(ctx context.Context, msg proto.Message)
return nil return nil
} }
if r.db.HasBlock(ctx, blockRoot) {
return nil
}
// Handle block when the parent is unknown // Handle block when the parent is unknown
if !r.db.HasBlock(ctx, bytesutil.ToBytes32(block.ParentRoot)) { if !r.db.HasBlock(ctx, bytesutil.ToBytes32(block.ParentRoot)) {
r.pendingQueueLock.Lock() r.pendingQueueLock.Lock()