OSDN Git Service

edit the sync config (#563)
authorPaladz <yzhu101@uottawa.ca>
Wed, 27 Jan 2021 09:17:49 +0000 (17:17 +0800)
committerGitHub <noreply@github.com>
Wed, 27 Jan 2021 09:17:49 +0000 (17:17 +0800)
Co-authored-by: paladz <colt@ColtdeMacBook-Pro.local>
netsync/chainmgr/block_keeper.go
netsync/chainmgr/handle.go

index 7707cff..b7b394c 100644 (file)
@@ -24,7 +24,7 @@ const (
 )
 
 var (
-       maxNumOfBlocksPerMsg      = uint64(1000)
+       maxNumOfBlocksPerMsg      = uint64(64)
        maxNumOfHeadersPerMsg     = uint64(1000)
        maxNumOfBlocksRegularSync = uint64(128)
 )
index c1538b5..152367d 100644 (file)
@@ -157,13 +157,18 @@ func (m *Manager) handleGetBlockMsg(peer *peers.Peer, msg *msgs.GetBlockMessage)
 }
 
 func (m *Manager) handleGetBlocksMsg(peer *peers.Peer, msg *msgs.GetBlocksMessage) {
-       endTime := time.Now().Add(requireBlocksTimeout / 2)
+       endTime := time.Now().Add(requireBlocksTimeout / 10)
        isTimeout := func() bool {
                return time.Now().After(endTime)
        }
 
        blocks, err := m.blockKeeper.locateBlocks(msg.GetBlockLocator(), msg.GetStopHash(), isTimeout)
        if err != nil || len(blocks) == 0 {
+               log.WithFields(log.Fields{
+                       "module": logModule,
+                       "err":    err,
+                       "size":   len(blocks),
+               }).Error("fail on handleGetBlocksMsg locateBlocks")
                return
        }