Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion common/constant/blockchainSync.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ const (
DefaultNumberOfForkConfirmations int32 = 1
PeerGetBlocksLimit uint32 = 1440
CommonMilestoneBlockIdsLimit int32 = 10
SafeBlockGap uint32 = 1440
SafeBlockGap uint32 = uint32(MinRollbackBlocks / 2)
// @iltoga change this to 2 for testing snapshots
MinRollbackBlocks uint32 = 720 // production 720
MaxCommonMilestoneRequestTrial uint32 = MinRollbackBlocks/uint32(CommonMilestoneBlockIdsLimit) + 1
MinimumPeersBlocksToDownload int32 = 2
)
2 changes: 1 addition & 1 deletion core/blockchainsync/downloadBlockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (bd *BlockchainDownloader) GetPeerBlockchainInfo() (*PeerBlockchainInfo, er
monitoring.IncrementMainchainDownloadCycleDebugger(bd.ChainType, 41)
chainBlockIds := bd.getBlockIdsAfterCommon(peer, commonMilestoneBlockID)
monitoring.IncrementMainchainDownloadCycleDebugger(bd.ChainType, 42)
if len(chainBlockIds) < 2 || !bd.PeerHasMore {
if int32(len(chainBlockIds)) < constant.MinimumPeersBlocksToDownload || !bd.PeerHasMore {
monitoring.IncrementMainchainDownloadCycleDebugger(bd.ChainType, 43)
return &PeerBlockchainInfo{
Peer: peer,
Expand Down
5 changes: 4 additions & 1 deletion core/blockchainsync/processFork.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ func (fp *ForkingProcessor) ProcessFork(forkBlocks []*model.Block, commonBlock *
// rebuilding the chain
monitoring.IncrementMainchainDownloadCycleDebugger(fp.ChainType, 88)
for _, block := range forkBlocks {
if block.ID == lastBlock.ID {
continue
}
monitoring.IncrementMainchainDownloadCycleDebugger(fp.ChainType, 89)
lastBlock, err = fp.BlockService.GetLastBlock()
monitoring.IncrementMainchainDownloadCycleDebugger(fp.ChainType, 90)
Expand Down Expand Up @@ -107,7 +110,7 @@ func (fp *ForkingProcessor) ProcessFork(forkBlocks []*model.Block, commonBlock *
if blacklistErr != nil {
fp.Logger.Errorf("Failed to add blacklist: %v\n", blacklistErr)
}
fp.Logger.Warnf("\n\nPushBlock err %v\n\n", err)
fp.Logger.Warnf("\n\nPushBlock of fork blocks err %v\n\n", err)
break
}

Expand Down