mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
update submitted ntime!
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user