Skip to content

Commit

Permalink
Merge pull request ethereumproject#313 from ethereumproject/p2p/good-…
Browse files Browse the repository at this point in the history
…will

p2p: good will assumption for the DAO fork
  • Loading branch information
sorpaas authored Jul 23, 2017
2 parents a1644fa + f33d7ad commit f69b80b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,25 +405,24 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
return errResp(ErrDecode, "msg %v: %v", msg, err)
}
// Filter out any explicitly requested headers, deliver the rest to the downloader
isForkCheck := len(headers) == 1
if isForkCheck {
if len(headers) == 0 || len(headers) == 1 {
if p.timeout != nil {
// Disable the fork drop timeout
p.timeout.Stop()
p.timeout = nil
}
}
if len(headers) == 1 {
if err := pm.chainConfig.HeaderCheck(headers[0]); err != nil {
pm.removePeer(p.id)
return err
}
// Irrelevant of the fork checks, send the header to the fetcher just in case
headers = pm.fetcher.FilterHeaders(headers, time.Now())
}
if len(headers) > 0 || !isForkCheck {
err := pm.downloader.DeliverHeaders(p.id, headers)
if err != nil {
glog.V(logger.Debug).Infoln(err)
}
err := pm.downloader.DeliverHeaders(p.id, headers)
if err != nil {
glog.V(logger.Debug).Infoln(err)
}

case p.version >= eth62 && msg.Code == GetBlockBodiesMsg:
Expand Down

0 comments on commit f69b80b

Please sign in to comment.