Guest User

Untitled

a guest
Jan 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. web3.eth.getBlock("pending",(function(e,r){
  2. var b = r.transactions.length;
  3. console.log(b);
  4. console.log(web3.eth.mining);
  5. if (!e){
  6. if (b > 0) {
  7. if (web3.eth.mining) return;
  8. console.log("== Pending transactions! Mining...");
  9. web3.miner.start(1);
  10. } else {
  11. web3.miner.stop(0); // This param means nothing
  12. console.log("== No transactions! Mining stopped.");
  13. }
  14.  
  15. }}))
Add Comment
Please, Sign In to add comment