Skip to content
Snippets Groups Projects
Commit 6959f9f1 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] Put constants in a ProverConstants

parent 42ca7a5a
No related branches found
No related tags found
2 merge requests!1216[enh] Ecomode improvements,!1214Reduce cpu
......@@ -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)
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment