Last active
July 28, 2021 03:26
-
-
Save mohamedmansour/183260a0f53a20d2eea5b0db6cb150a9 to your computer and use it in GitHub Desktop.
Geth Sync Status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 8% ETA: 53 minutes @ 1477.9bps | |
// 9% ETA: 27 minutes @ 2918.6bps | |
// 9% ETA: 34 minutes @ 2323.4bps | |
// 10% ETA: 34 minutes @ 2304.8bps | |
// 10% ETA: 37 minutes @ 2149.6bps | |
// 11% ETA: 36 minutes @ 2186bps | |
// 11% ETA: 35 minutes @ 2268bps | |
// 12% ETA: 30 minutes @ 2630.4bps | |
// | |
// To get the following console statements printed in geth, attach to your geth console (geth attach) and copy paste the codeblock below. | |
// | |
// START COPY -------------------- | |
var lastPercentage = 0; | |
var lastBlocksToGo = 0; | |
var timeInterval = 10000; | |
function pollMonitor() { | |
var percentage = eth.syncing.currentBlock / eth.syncing.highestBlock * 100; | |
var percentagePerTime = percentage - lastPercentage; | |
var blocksToGo = eth.syncing.highestBlock - eth.syncing.currentBlock; | |
var bps = (lastBlocksToGo - blocksToGo) / (timeInterval / 1000) | |
var etas = 100 / percentagePerTime * (timeInterval / 1000) | |
var etaM = parseInt(etas / 60, 10); | |
if (etaM > 0) { | |
console.log(parseInt(percentage, 10) + '% ETA: '+ etaM + ' minutes @ '+ bps + 'bps, PEERCOUNT: ' + net.peerCount); | |
} else { | |
console.log(parseInt(percentage, 10) + '% PEERCOUNT: ' + net.peerCount + ', Starting monitor, polling every 10 sec...'); | |
} | |
lastPercentage = percentage; | |
lastBlocksToGo = blocksToGo; | |
return true | |
} | |
function run() { | |
pollMonitor(); | |
setInterval(pollMonitor, timeInterval); | |
} | |
run() | |
// END COPY -------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment