update submitted ntime!

This commit is contained in:
Ben Wilson
2023-06-30 09:06:39 -04:00
parent ea726bbba4
commit 385f5c56ef
2 changed files with 7 additions and 4 deletions
+4 -2
View File
@@ -76,7 +76,7 @@ export class MiningJob {
} }
public copyAndUpdateBlock(versionMaskString: number, nonce: number, extraNonce: string, extraNonce2: string): bitcoinjs.Block { public copyAndUpdateBlock(versionMaskString: number, nonce: number, extraNonce: string, extraNonce2: string, timestamp: number): bitcoinjs.Block {
const testBlock = bitcoinjs.Block.fromBuffer(this.block.toBuffer()); const testBlock = bitcoinjs.Block.fromBuffer(this.block.toBuffer());
@@ -93,7 +93,9 @@ export class MiningJob {
//@ts-ignore //@ts-ignore
//recompute the root //recompute the root
testBlock.merkleRoot = this.calculateMerkleRootHash(testBlock.transactions[0].__toBuffer(), this.merkle_branch);; testBlock.merkleRoot = this.calculateMerkleRootHash(testBlock.transactions[0].__toBuffer(), this.merkle_branch);
testBlock.timestamp = timestamp
return testBlock; return testBlock;
} }
+3 -2
View File
@@ -299,7 +299,8 @@ export class StratumV1Client extends EasyUnsubscribe {
parseInt(submission.versionMask, 16), parseInt(submission.versionMask, 16),
parseInt(submission.nonce, 16), parseInt(submission.nonce, 16),
this.extraNonce, this.extraNonce,
submission.extraNonce2 submission.extraNonce2,
parseInt(submission.ntime, 16)
); );
const submissionDifficulty = this.calculateDifficulty(updatedJobBlock.toBuffer(true)); const submissionDifficulty = this.calculateDifficulty(updatedJobBlock.toBuffer(true));
@@ -308,7 +309,7 @@ export class StratumV1Client extends EasyUnsubscribe {
if (submissionDifficulty >= this.sessionDifficulty) { if (submissionDifficulty >= this.sessionDifficulty) {
if (submissionDifficulty >= (job.networkDifficulty / 2)) { if (submissionDifficulty >= (job.networkDifficulty / 2)) {
console.log('!!! BOCK FOUND !!!'); console.log('!!! BLOCK FOUND !!!');
const blockHex = updatedJobBlock.toHex(false); const blockHex = updatedJobBlock.toHex(false);
this.bitcoinRpcService.SUBMIT_BLOCK(blockHex); this.bitcoinRpcService.SUBMIT_BLOCK(blockHex);
} }