goimports staged stream sync

pull/4465/head
“GheisMohammadi” 1 year ago
parent 6f3aa67b88
commit e11b6ef122
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 2
      api/service/stagedstreamsync/const.go
  2. 34
      api/service/stagedstreamsync/staged_stream_sync.go
  3. 2
      api/service/stagedstreamsync/stages.go
  4. 6
      api/service/stagedstreamsync/state_download_manager.go

@ -27,7 +27,7 @@ const (
StatesPerRequest int = 100 StatesPerRequest int = 100
// maximum number of blocks for get receipts request // maximum number of blocks for get receipts request
ReceiptsPerRequest int = 10 ReceiptsPerRequest int = 10
// DefaultConcurrency is the default settings for concurrency // DefaultConcurrency is the default settings for concurrency
DefaultConcurrency int = 4 DefaultConcurrency int = 4

@ -59,23 +59,23 @@ func (ib *InvalidBlock) addBadStream(bsID sttypes.StreamID) {
} }
type StagedStreamSync struct { type StagedStreamSync struct {
bc core.BlockChain bc core.BlockChain
consensus *consensus.Consensus consensus *consensus.Consensus
isBeacon bool isBeacon bool
isExplorer bool isExplorer bool
db kv.RwDB db kv.RwDB
protocol syncProtocol protocol syncProtocol
isBeaconNode bool isBeaconNode bool
gbm *blockDownloadManager // initialized when finished get block number gbm *blockDownloadManager // initialized when finished get block number
lastMileBlocks []*types.Block // last mile blocks to catch up with the consensus rdm *receiptDownloadManager
lastMileMux sync.Mutex lastMileBlocks []*types.Block // last mile blocks to catch up with the consensus
inserted int lastMileMux sync.Mutex
config Config inserted int
logger zerolog.Logger config Config
status *status //TODO: merge this with currentSyncCycle logger zerolog.Logger
initSync bool // if sets to true, node start long range syncing status *status //TODO: merge this with currentSyncCycle
UseMemDB bool initSync bool // if sets to true, node start long range syncing
UseMemDB bool
revertPoint *uint64 // used to run stages revertPoint *uint64 // used to run stages
prevRevertPoint *uint64 // used to get value from outside of staged sync after cycle (for example to notify RPCDaemon) prevRevertPoint *uint64 // used to get value from outside of staged sync after cycle (for example to notify RPCDaemon)
invalidBlock InvalidBlock invalidBlock InvalidBlock

@ -13,7 +13,7 @@ const (
SyncEpoch SyncStageID = "SyncEpoch" // epoch sync SyncEpoch SyncStageID = "SyncEpoch" // epoch sync
BlockBodies SyncStageID = "BlockBodies" // Block bodies are downloaded, TxHash and UncleHash are getting verified BlockBodies SyncStageID = "BlockBodies" // Block bodies are downloaded, TxHash and UncleHash are getting verified
States SyncStageID = "States" // will construct most recent state from downloaded blocks States SyncStageID = "States" // will construct most recent state from downloaded blocks
StateSync SyncStageID = "StateSync" // State sync StateSync SyncStageID = "StateSync" // State sync
Receipts SyncStageID = "Receipts" // Receipts Receipts SyncStageID = "Receipts" // Receipts
LastMile SyncStageID = "LastMile" // update blocks after sync and update last mile blocks as well LastMile SyncStageID = "LastMile" // update blocks after sync and update last mile blocks as well
Finish SyncStageID = "Finish" // Nominal stage after all other stages Finish SyncStageID = "Finish" // Nominal stage after all other stages

@ -229,13 +229,13 @@ func (s *StateDownloadManager) HandleRequestError(codeHashes []common.Hash, trie
// add requested code hashes to retries // add requested code hashes to retries
for _, h := range codeHashes { for _, h := range codeHashes {
s.retries.addCodeTask(h,s.requesting.codeTasks[h]) s.retries.addCodeTask(h, s.requesting.codeTasks[h])
delete(s.requesting.codeTasks, h) delete(s.requesting.codeTasks, h)
} }
// add requested trie paths to retries // add requested trie paths to retries
for _, path := range triePaths { for _, path := range triePaths {
s.retries.addTrieTask(path,s.requesting.trieTasks[path]) s.retries.addTrieTask(path, s.requesting.trieTasks[path])
delete(s.requesting.trieTasks, path) delete(s.requesting.trieTasks, path)
} }
} }
@ -282,7 +282,7 @@ func (s *StateDownloadManager) HandleRequestResult(codeHashes []common.Hash, tri
} }
for _, hash := range codeHashes { for _, hash := range codeHashes {
task:= s.requesting.getCodeTask(hash) task := s.requesting.getCodeTask(hash)
// If the node did deliver something, missing items may be due to a protocol // If the node did deliver something, missing items may be due to a protocol
// limit or a previous timeout + delayed delivery. Both cases should permit // limit or a previous timeout + delayed delivery. Both cases should permit
// the node to retry the missing items (to avoid single-peer stalls). // the node to retry the missing items (to avoid single-peer stalls).

Loading…
Cancel
Save