Only Perform Initial Sync With a Single Peer (#2471)

* fix spacing

* use send instead of broadcast in initial sync
This commit is contained in:
Raul Jordan 2019-05-02 14:36:23 -05:00 committed by Preston Van Loon
parent f876df42d7
commit 629b76cf44
2 changed files with 4 additions and 3 deletions

View File

@ -63,7 +63,6 @@ func DefaultConfig() *Config {
}
type p2pAPI interface {
p2p.Broadcaster
p2p.Sender
Subscribe(msg proto.Message, channel chan p2p.Message) event.Subscription
}

View File

@ -117,10 +117,12 @@ func (s *InitialSync) requestBatchedBlocks(startSlot uint64, endSlot uint64) {
"slotSlot": startSlot - params.BeaconConfig().GenesisSlot,
"endSlot": endSlot - params.BeaconConfig().GenesisSlot},
).Debug("Requesting batched blocks")
s.p2p.Broadcast(ctx, &pb.BatchedBeaconBlockRequest{
if err := s.p2p.Send(ctx, &pb.BatchedBeaconBlockRequest{
StartSlot: startSlot,
EndSlot: endSlot,
})
}, s.bestPeer); err != nil {
log.Errorf("Could not send batch block request to peer %s: %v", s.bestPeer.Pretty(), err)
}
}
// validateAndSaveNextBlock will validate whether blocks received from the blockfetcher