Ensure mintime is considered for jobs

This commit is contained in:
Benjamin Wilson
2024-09-27 13:01:36 -04:00
parent 8ce057b3b5
commit 4282233d2f
+2 -1
View File
@@ -66,13 +66,14 @@ export class StratumV1JobsService {
this.lastIntervalCount = interval; this.lastIntervalCount = interval;
const currentTime = Math.floor(new Date().getTime() / 1000);
return { return {
version: blockTemplate.version, version: blockTemplate.version,
bits: parseInt(blockTemplate.bits, 16), bits: parseInt(blockTemplate.bits, 16),
prevHash: this.convertToLittleEndian(blockTemplate.previousblockhash), prevHash: this.convertToLittleEndian(blockTemplate.previousblockhash),
transactions: blockTemplate.transactions.map(t => bitcoinjs.Transaction.fromHex(t.data)), transactions: blockTemplate.transactions.map(t => bitcoinjs.Transaction.fromHex(t.data)),
coinbasevalue: blockTemplate.coinbasevalue, coinbasevalue: blockTemplate.coinbasevalue,
timestamp: Math.floor(new Date().getTime() / 1000), timestamp: blockTemplate.mintime > currentTime ? blockTemplate.mintime : currentTime,
networkDifficulty: this.calculateNetworkDifficulty(parseInt(blockTemplate.bits, 16)), networkDifficulty: this.calculateNetworkDifficulty(parseInt(blockTemplate.bits, 16)),
clearJobs, clearJobs,
height: blockTemplate.height height: blockTemplate.height