Verified Commit 4804f6c4 authored by Silvio Rhatto's avatar Silvio Rhatto
Browse files

Feat(mine): adds option to limit the total number of keys per pool

parent 2722771f
......@@ -35,6 +35,16 @@ fi
# Create folders
mkdir -p $CANDIDATES $LOGS
# Check the total number of any existing candidates
if [ ! -z "$MAX_GENERATED_KEYS" ] && [ "$MAX_GENERATED_KEYS" != "0" ]; then
TOTAL_KEYS="`ls -1 $CANDIDATES | wc -l`"
if (($TOTAL_KEYS >= $MAX_GENERATED_KEYS)); then
echo "$BASENAME: $CONFIG pool already have $TOTAL_KEYS candidate keys, and a limit of $MAX_GENERATED_KEYS is configured. Aborting."
exit 1
fi
fi
# Compile
echo "$BASENAME: compiling mkp224o to make sure it's built with the current flags..."
make -C $BASEDIR compile
......
......@@ -17,8 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# HINT: You can use env variables depending on the script that invokes this
# file (compile, mine etc).
# HINT: You can use any parameter defined at `bin/params`.
#
#
......@@ -51,8 +50,10 @@ MKP224O_RUN_FLAGS="-s -d $CANDIDATES -f $FILTERS -B"
# Passphrase should be provided via the PASSPHRASE environment variable
#MKP224O_RUN_FLAGS="-s --checkpoint $CHECKPOINT -d $CANDIDATES -f $FILTERS -B -P"
# Use the following if you want to limit the number of generated keys Useful
# wen running inside a batch job
# Limit the number of keys per pool at each run
#
# Use the following if you want to limit the number of generated keys each
# time the mkp224o runs. Useful wen running inside a batch job.
#
# When combined with passphrase handling, enables one to easily stop and
# resume key generation in steps and check for acceptable keys before
......@@ -60,7 +61,7 @@ MKP224O_RUN_FLAGS="-s -d $CANDIDATES -f $FILTERS -B"
#MKP224O_RUN_FLAGS="$MKP224O_RUN_FLAGS -n 100"
# Use the following if you're satisfied with a single key that matches
# any of the configured filter.
# any of the configured filters each time mkp224o runs.
#
# Useful when looking for longer filter (n >= 7 chars) and any match
# is acceptable.
......@@ -87,3 +88,18 @@ MKP224O_RUN_FLAGS="-s -d $CANDIDATES -f $FILTERS -B"
# Fetch the passphrase using https://0xacab.org/rhatto/keyringer/
# Different values of $CONFIG might have different keys
#PASSPHRASE="`keyringer my-keyring decrypt onionmine/$CONFIG/passphrase 2> /dev/null | head -1`"
#
# Other options
#
# Limit the total number of keys per pool
#
# Limit the total number of keys generated in a pool's `candidates/` folder, no
# matter how many times mkp224o is invoked.
#
# Can be combined with mkp224o's "-n" flag, allowing to set bot a per-mining
# sessions and a total keys generated.
#
# Setting to "0" disables the limit.
#MAX_GENERATED_KEYS="0"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment