diff --git a/eth/downloader/skeleton.go b/eth/downloader/skeleton.go index b3edda7a0c..fe7d6fb436 100644 --- a/eth/downloader/skeleton.go +++ b/eth/downloader/skeleton.go @@ -500,7 +500,12 @@ func (s *skeleton) sync(head *types.Header) (*types.Header, error) { log.Debug("Beacon sync merged subchains") return nil, errSyncMerged } - // We still have work to do, loop and repeat + // We still have work to do, loop and repeat + + default: + log.Debug("Select loop timeout, no events received") + // sleep a short time + time.Sleep(time.Millisecond * 100) } } } @@ -911,7 +916,18 @@ func (s *skeleton) revertRequest(req *headerRequest) { // Remove the request from the tracked set and mark the task as not-pending, // ready for rescheduling + log.Warn("ZXL: revert request", "tasknum", (s.scratchHead-req.head)/requestHeaders, "peerId", req.peer) s.scratchOwners[(s.scratchHead-req.head)/requestHeaders] = "" + // retry + //s.idles[req.peer] = s.getPeerConnectionByPeerId(req.peer) // not here but need here +} + +func (s *skeleton) getPeerConnectionByPeerId(peer string) *peerConnection { + peerConn, ok := s.peers.peers[peer] + if !ok { + return nil + } + return peerConn } func (s *skeleton) processResponse(res *headerResponse) (linked bool, merged bool) { diff --git a/eth/protocols/eth/handler.go b/eth/protocols/eth/handler.go index 0fd495fc3f..3001e7ccbe 100644 --- a/eth/protocols/eth/handler.go +++ b/eth/protocols/eth/handler.go @@ -17,6 +17,7 @@ package eth import ( + "errors" "fmt" "math/big" "time" @@ -24,6 +25,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/etherror" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/enode" @@ -160,11 +162,11 @@ func Handle(backend Backend, peer *Peer) error { case errors.Is(err, etherror.ErrNoHeadersDelivered): // ignore no headers delivered peer.Log().Warn("Message handling failed with no headers") - - case errors.Is(err, etherror.ErrHeaderBatchAnchorLow): - // ignore lower header anchor within tolerance - peer.Log().Warn("Message handling failed with lower batch anchor") */ + case errors.Is(err, etherror.ErrHeaderBatchAnchorLow): + // ignore lower header anchor within tolerance + peer.Log().Warn("Message handling failed with lower batch anchor") + case err != nil: peer.Log().Debug("Message handling failed in `eth`", "err", err) return err