Prevent duplicate share submissions - this is why we can't have nice things

This commit is contained in:
Ben
2025-04-27 13:06:06 -04:00
parent e7f7cb52af
commit e1b88207d3
2 changed files with 27 additions and 10 deletions
@@ -3,6 +3,8 @@ import { ArrayMaxSize, ArrayMinSize, IsArray, IsString } from 'class-validator';
import { eRequestMethod } from '../enums/eRequestMethod';
import { StratumBaseMessage } from './StratumBaseMessage';
import * as bitcoinjs from 'bitcoinjs-lib';
export class MiningSubmitMessage extends StratumBaseMessage {
@@ -63,6 +65,11 @@ export class MiningSubmitMessage extends StratumBaseMessage {
};
}
public hash(): string{
const buffer = Buffer.from(this.versionMask + this.nonce + this.extraNonce2 + this.ntime + this.jobId);
return bitcoinjs.crypto.hash256(buffer).toString('base64');
}