|
|
|
@ -41,8 +41,8 @@ func (self *App) main() { |
|
|
|
|
|
|
|
|
|
func (self *App) mainloop() { |
|
|
|
|
log.Infof("using %d fetching threads", self.config.desiredFetcherThreads) |
|
|
|
|
// we are going to do batches of 5,000 blocks
|
|
|
|
|
batchSize := uint(1000) |
|
|
|
|
//batchSize := uint(1000)
|
|
|
|
|
batchSize := uint(10) |
|
|
|
|
var start BlockNumber |
|
|
|
|
var end BlockNumber |
|
|
|
|
for { |
|
|
|
@ -52,10 +52,13 @@ func (self *App) mainloop() { |
|
|
|
|
time.Sleep(1 * time.Second) |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
log.Infof("current network block height = %d", self.db.CurrentNetworkBlockHeight()) |
|
|
|
|
log.Infof("current local block height = %d", self.db.CurrentLocalBlockHeight()) |
|
|
|
|
// we are not synced
|
|
|
|
|
|
|
|
|
|
// how far behind are we?
|
|
|
|
|
countMustFetch := uint(self.db.CurrentNetworkBlockHeight() - self.db.CurrentLocalBlockHeight()) |
|
|
|
|
log.Infof("we are %d blocks behind", countMustFetch) |
|
|
|
|
start = self.db.CurrentLocalBlockHeight() + 1 |
|
|
|
|
log.Infof("beginning fetch with start block %d", start) |
|
|
|
|
if countMustFetch <= batchSize { |
|
|
|
|