@@ -41,6 +41,11 @@ declareCounter nec_imported_transactions, "Transactions processed during import"
4141
4242declareCounter nec_imported_gas, " Gas processed during import"
4343
44+ declareGauge nec_download_block_number, " Latest in order downloaded block number"
45+
46+ declareCounter nec_downloaded_blocks, " Blocks downloaded during import"
47+
48+
4449var running {.volatile .} = true
4550
4651proc openCsv (name: string ): File =
@@ -187,7 +192,7 @@ proc run(config: NimbusConf): PortalNode {.
187192 # # Portal node setup
188193 let
189194 portalProtocolConfig = PortalProtocolConfig .init (
190- DefaultTableIpLimit , DefaultBucketIpLimit , DefaultBitsPerHop , defaultAlpha , RadiusConfig (kind: Static , logRadius: 249 ),
195+ DefaultTableIpLimit , DefaultBucketIpLimit , DefaultBitsPerHop , config.alpha , RadiusConfig (kind: Static , logRadius: 249 ),
191196 defaultDisablePoke, defaultMaxGossipNodes, defaultContentCacheSize,
192197 defaultDisableContentCache, defaultMaxConcurrentOffers, defaultDisableBanNodes,
193198 )
@@ -227,7 +232,7 @@ proc getBlockLoop(
227232 startBlock: uint64 ,
228233 portalWorkers: int ,
229234): Future [void ] {.async .} =
230- const bufferSize = 8192
235+ const bufferSize = 8192 * 4
231236
232237 let
233238 historyNetwork = node.historyNetwork.value ()
@@ -257,6 +262,7 @@ proc getBlockLoop(
257262
258263 continue
259264
265+ nec_downloaded_blocks.inc ()
260266 blocks[i] = init (EthBlock , header, body)
261267 downloadFinished[i] = true
262268 totalDownloadCount.inc ()
@@ -277,6 +283,9 @@ proc getBlockLoop(
277283
278284 while true :
279285 while downloadFinished[nextReadIndex]:
286+ # TODO : Fix this counter, it's not accurate as blockNumberOffset updates
287+ # differently than the block being passed around here
288+ nec_download_block_number.set ((blockNumberOffset + nextReadIndex.uint64 ).int64 )
280289 debug " Adding block to the processing queue" ,
281290 blockNumber = blockNumberOffset + nextReadIndex.uint64
282291 await blockQueue.addLast (blocks[nextReadIndex])
0 commit comments