StopPeerForError in blockchain and consensus

This commit is contained in:
Ethan Buchman
2018-01-21 13:32:04 -05:00
parent 813bb6af96
commit ee674f919f
9 changed files with 40 additions and 30 deletions

View File

@ -195,7 +195,8 @@ func (pool *BlockPool) PopRequest() {
// Invalidates the block at pool.height,
// Remove the peer and redo request from others.
func (pool *BlockPool) RedoRequest(height int64) {
// Returns the ID of the removed peer.
func (pool *BlockPool) RedoRequest(height int64) p2p.ID {
pool.mtx.Lock()
defer pool.mtx.Unlock()
@ -205,8 +206,8 @@ func (pool *BlockPool) RedoRequest(height int64) {
cmn.PanicSanity("Expected block to be non-nil")
}
// RemovePeer will redo all requesters associated with this peer.
// TODO: record this malfeasance
pool.removePeer(request.peerID)
return request.peerID
}
// TODO: ensure that blocks come in order for each peer.