This commit is contained in:
Ben Wilson
2023-07-16 17:41:53 -04:00
parent 43340e14fa
commit 772499a5b3
+7 -1
View File
@@ -29,6 +29,7 @@ export class StratumV1JobsService {
public newMiningJob$: Observable<IJobTemplate>; public newMiningJob$: Observable<IJobTemplate>;
public latestJobId: number = 1; public latestJobId: number = 1;
public latestJobTemplateId: number = 1;
public jobs: MiningJob[] = []; public jobs: MiningJob[] = [];
@@ -108,11 +109,13 @@ export class StratumV1JobsService {
block.transactions = transactions; block.transactions = transactions;
block.witnessCommit = bitcoinjs.Block.calculateMerkleRoot(transactions, true); block.witnessCommit = bitcoinjs.Block.calculateMerkleRoot(transactions, true);
const id = this.getNextTemplateId();
this.latestJobTemplateId++;
return { return {
block, block,
merkle_branch, merkle_branch,
blockData: { blockData: {
id: this.getNextId(), id,
littleEndianBlockHeight, littleEndianBlockHeight,
coinbasevalue, coinbasevalue,
networkDifficulty, networkDifficulty,
@@ -167,6 +170,9 @@ export class StratumV1JobsService {
return this.jobs.find(job => job.jobId == jobId); return this.jobs.find(job => job.jobId == jobId);
} }
public getNextTemplateId() {
return this.latestJobTemplateId.toString(16);
}
public getNextId() { public getNextId() {
return this.latestJobId.toString(16); return this.latestJobId.toString(16);
} }