embark/js/mine.js

13 lines
280 B
JavaScript
Raw Normal View History

2015-05-24 13:04:44 +00:00
setInterval(function() {
2015-05-24 13:36:19 +00:00
var minimalAmount = (web3.eth.getBalance(web3.eth.coinbase) >= 1500000000000000000);
if(!web3.eth.mining && (!minimalAmount || web3.eth.pendingTransactions().length > 0)) {
2015-05-24 13:04:44 +00:00
admin.miner.start();
}
else {
admin.miner.stop();
}
}, 1000)