From 5a3e7bab34dfe8451c5d0179076bdb55daeab37e Mon Sep 17 00:00:00 2001 From: Robert Martin-Legene <robert@nic.ar> Date: Fri, 27 Jul 2018 17:46:01 -0300 Subject: [PATCH] Set our mining state according to what the chain says is allowed --- bin/maymine.js | 4 ++++ bin/maymine.sh | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 bin/maymine.js create mode 100755 bin/maymine.sh diff --git a/bin/maymine.js b/bin/maymine.js new file mode 100644 index 0000000..cb05823 --- /dev/null +++ b/bin/maymine.js @@ -0,0 +1,4 @@ +var signer +signer = (clique.getSigners().indexOf(eth.accounts[0]) > -1) +if (signer) miner.start() else miner.stop() +console.log( signer ) diff --git a/bin/maymine.sh b/bin/maymine.sh new file mode 100755 index 0000000..1a180f4 --- /dev/null +++ b/bin/maymine.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Robert Martin-Legene <robert@nic.ar> + +if [ -z "${BFAHOME}" ]; then echo "\$BFAHOME not set. Did you source bfa/bin/env ?" >&2; exit 1; fi +source ${BFAHOME}/bin/libbfa.sh || exit 1 + +res=$( geth_execjs "${BFAHOME}/bin/maymine.js" ) + +if [ "$res" = "true" ] +then + touch ${BFANODEDIR}/miner +else + rm -f ${BFANODEDIR}/miner +fi -- GitLab