mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
Raise SV2 retained job limit
This commit is contained in:
@@ -927,6 +927,41 @@ describe('StratumV2Client extended channels', () => {
|
||||
)).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps enough retained SV2 jobs for repeated fast activation and full-template followup cycles', async () => {
|
||||
const { client, jobTemplate } = await createClient();
|
||||
await (client as any).handleOpenExtendedMiningChannel(serializeOpenExtendedMiningChannel({
|
||||
requestId: 1,
|
||||
userIdentity: 'tb1qumezefzdeqqwn5zfvgdrhxjzc5ylr39uhuxcz4.worker',
|
||||
nominalHashRate: 0,
|
||||
maxTarget: Buffer.alloc(32, 0xff),
|
||||
minExtranonceSize: 8,
|
||||
}));
|
||||
|
||||
let currentTemplate = jobTemplate;
|
||||
for (let index = 0; index < 20; index++) {
|
||||
const activation = {
|
||||
...createActivationTemplate(currentTemplate),
|
||||
previousblockhash: (index + 1).toString(16).padStart(64, '0'),
|
||||
mintime: parseInt(MockRecording1.TIME, 16) + index + 1,
|
||||
curtime: parseInt(MockRecording1.TIME, 16) + index + 1,
|
||||
};
|
||||
await client.enqueueWorkActivation(activation as any);
|
||||
currentTemplate = {
|
||||
...createCanonicalFollowup(currentTemplate, activation),
|
||||
blockData: {
|
||||
...createCanonicalFollowup(currentTemplate, activation).blockData,
|
||||
id: `canonical-followup-${index}`,
|
||||
},
|
||||
};
|
||||
await client.enqueueCanonicalJob(currentTemplate);
|
||||
}
|
||||
|
||||
expect((client as any).socket.destroyed).toBe(false);
|
||||
const channel = (client as any).channels.get(1);
|
||||
expect(channel.extendedJobs.size).toBeLessThanOrEqual((client as any).maxRetainedJobsPerChannel);
|
||||
expect(channel.stagedFutureJobId).toBeDefined();
|
||||
});
|
||||
|
||||
it('activates a staged standard future and rejects incompatible activation versions', async () => {
|
||||
const { client, sentFrames, jobTemplate } = await createClient();
|
||||
await (client as any).handleOpenStandardMiningChannel(serializeOpenStandardMiningChannel({
|
||||
|
||||
@@ -78,7 +78,7 @@ const DEFAULT_DIFFICULTY_CHECK_INTERVAL_MS = 60 * 1000;
|
||||
const DEFAULT_CLIENT_HASHRATE_PERSIST_INTERVAL_MS = 60 * 1000;
|
||||
const FIXED_STANDARD_EXTRANONCE2 = '0000000000000000';
|
||||
const DEFAULT_SV2_JOB_RETENTION_MS = 5 * 60 * 1000;
|
||||
const DEFAULT_SV2_MAX_RETAINED_JOBS_PER_CHANNEL = 16;
|
||||
const DEFAULT_SV2_MAX_RETAINED_JOBS_PER_CHANNEL = 64;
|
||||
const DEFAULT_SV2_MAX_QUEUED_JOB_OPERATIONS = 4;
|
||||
const DEFAULT_SV2_MAX_SOCKET_BUFFER_BYTES = 256 * 1024;
|
||||
const DEFAULT_SV2_SOCKET_WRITE_TIMEOUT_MS = 2 * 1000;
|
||||
|
||||
Reference in New Issue
Block a user