Created
May 28, 2020 12:42
-
-
Save meowsbits/36b8bb2ccdce54ab3ab4599d6de50ed6 to your computer and use it in GitHub Desktop.
When and if geth's CPU miner drops below floor hashrate, switch off and restart mining after an interval.
This file contains 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
var hashrateFloor = 20000; | |
for (;true;) { | |
var sleepInterval = 60; | |
if (!eth.mining) { | |
console.log(Date(), "starting miner") | |
miner.start(); | |
sleepInterval = 60*10; | |
} | |
var hashrate = miner.getHashrate(); | |
console.log(Date() , "hashrate", hashrate); | |
if (hashrate < hashrateFloor) { | |
console.log(Date(), "hashrate below floor, stopping miner") | |
miner.stop(); | |
sleepInterval = 60*30; | |
} | |
admin.sleep(sleepInterval); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment