Skip to content

Commit

Permalink
[sync] changed param to support low network bandwidth against large b…
Browse files Browse the repository at this point in the history
…lock (#3766)

* [sync] changed param to support low network bandwidth against large block

* [sync] increase the retry limit per process loop
  • Loading branch information
JackyWYX authored Jun 12, 2021
1 parent f023824 commit ba08520
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/service/legacysync/downloader/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (client *Client) GetBlocks(hashes [][]byte) *pb.DownloaderResponse {

// GetBlocksAndSigs get blockWithSig in serialization byte array by calling a grpc request
func (client *Client) GetBlocksAndSigs(hashes [][]byte) *pb.DownloaderResponse {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)
defer cancel()
request := &pb.DownloaderRequest{Type: pb.DownloaderRequest_BLOCK, GetBlocksWithSig: true}
request.Hashes = make([][]byte, len(hashes))
Expand Down
10 changes: 5 additions & 5 deletions api/service/legacysync/syncing.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ import (

// Constants for syncing.
const (
downloadBlocksRetryLimit = 5 // downloadBlocks service retry limit
downloadBlocksRetryLimit = 10 // downloadBlocks service retry limit
RegistrationNumber = 3
SyncingPortDifference = 3000
inSyncThreshold = 0 // when peerBlockHeight - myBlockHeight <= inSyncThreshold, it's ready to join consensus
SyncLoopBatchSize uint32 = 1000 // maximum size for one query of block hashes
verifyHeaderBatchSize uint64 = 100 // block chain header verification batch size
inSyncThreshold = 0 // when peerBlockHeight - myBlockHeight <= inSyncThreshold, it's ready to join consensus
SyncLoopBatchSize uint32 = 30 // maximum size for one query of block hashes
verifyHeaderBatchSize uint64 = 100 // block chain header verification batch size (not used for now)
LastMileBlocksSize = 50

// after cutting off a number of connected peers, the result number of peers
// shall be between numPeersLowBound and numPeersHighBound
NumPeersLowBound = 3
numPeersHighBound = 5

downloadTaskBatch = 15
downloadTaskBatch = 5
)

// SyncPeerConfig is peer config to sync.
Expand Down

0 comments on commit ba08520

Please sign in to comment.