diff --git a/app/modules/prover/lib/blockProver.ts b/app/modules/prover/lib/blockProver.ts index 03676a8f4daa5f6bc7a8cb0f8716615a68544adf..f3e036770c0a9bd84a98312be58c031f4f4fc753 100644 --- a/app/modules/prover/lib/blockProver.ts +++ b/app/modules/prover/lib/blockProver.ts @@ -201,12 +201,12 @@ export class BlockProver { this.logger.info('Done: #%s, %s in %ss instead of %ss (%s tests, ~%s tests/s)', block.number, proof.hash, (duration / 1000).toFixed(2), this.conf.avgGenTime, testsCount, testsPerSecond.toFixed(2)); this.logger.info('FOUND proof-of-work with %s leading zeros followed by [0-' + highMark + ']!', nbZeros); - if(this.conf.ecoMode === true && this.conf.nbCores*testsPerSecond > 300) { + if(this.conf.ecoMode === true && this.conf.nbCores*testsPerSecond > ProverConstants.ECO_MODE_MINIMAL_TESTS_PER_SECONDS) { if(this.conf.nbCores > 1) { this.logger.info("Reducing number of CPU cores "+this.conf.nbCores) this.conf.nbCores = this.conf.nbCores -1 } - else if(this.conf.cpu > 0.19){ + else if(this.conf.cpu > ProverConstants.ECO_MODE_MINIMAL_CPU){ let cpu:number = this.conf.cpu - 0.1 this.logger.info("Slowing down the CPU to "+cpu) this.changeCPU(cpu) diff --git a/app/modules/prover/lib/constants.ts b/app/modules/prover/lib/constants.ts index 2b8299c335620178aa08a47f85452b6e53eef058..3a8d77c701a06fadd6d32eb0f5207098ad6b9df3 100644 --- a/app/modules/prover/lib/constants.ts +++ b/app/modules/prover/lib/constants.ts @@ -11,6 +11,9 @@ export const ProverConstants = { MIN_PEER_ID: 1, MAX_PEER_ID: 899, // Due to MAX_SAFE_INTEGER = 9007199254740991 (16 digits, and we use 11 digits for the nonce + 2 digits for core number => 3 digits for the peer, must be below 900) + ECO_MODE_MINIMAL_TESTS_PER_SECONDS: 300, + ECO_MODE_MINIMAL_CPU: 0.19, + NONCE_RANGE: 1000 * 1000 * 1000 * 100, POW_MAXIMUM_ACCEPTABLE_HANDICAP: 64,