diff --git a/app/modules/prover/lib/permanentProver.ts b/app/modules/prover/lib/permanentProver.ts index 033fdb4c70ddad6fa270499ec3fc5525610d9549..f0c974bbf7cc7d6868ff40ef864fb2b14fab4c7b 100644 --- a/app/modules/prover/lib/permanentProver.ts +++ b/app/modules/prover/lib/permanentProver.ts @@ -156,11 +156,15 @@ export class PermanentProver { // The generation (async () => { try { - const current = await this.server.dal.getCurrentBlockOrNull(); - const selfPubkey = this.server.keyPair.publicKey; - const trial2 = await this.server.getBcContext().getIssuerPersonalizedDifficulty(selfPubkey); - this.checkTrialIsNotTooHigh(trial2, current, selfPubkey); - this.lastComputedBlock = await this.generator.makeNextBlock(null, trial2); + let unsignedBlock = null, trial2 = 0 + await this.server.BlockchainService.pushFIFO('generatingNextBlock', async () => { + const current = await this.server.dal.getCurrentBlockOrNull(); + const selfPubkey = this.server.keyPair.publicKey; + trial2 = await this.server.getBcContext().getIssuerPersonalizedDifficulty(selfPubkey); + this.checkTrialIsNotTooHigh(trial2, current, selfPubkey); + unsignedBlock = await this.generator.nextBlock() + }) + this.lastComputedBlock = await this.prover.prove(unsignedBlock, trial2, null) try { const obj = parsers.parseBlock.syncWrite(dos2unix(this.lastComputedBlock.getRawSigned())); await this.server.writeBlock(obj)