stratum: set_difficulty should always be a notification (#32)

This commit is contained in:
Georges
2024-02-23 12:51:27 -05:00
committed by GitHub
parent 9f723782ab
commit 8c62817f73
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -202,7 +202,7 @@ describe('StratumV1Client', () => {
expect(socket.on).toHaveBeenCalled(); expect(socket.on).toHaveBeenCalled();
socketEmitter(Buffer.from(MockRecording1.MINING_SUGGEST_DIFFICULTY)); socketEmitter(Buffer.from(MockRecording1.MINING_SUGGEST_DIFFICULTY));
await new Promise((r) => setTimeout(r, 1)); await new Promise((r) => setTimeout(r, 1));
expect(socket.write).toHaveBeenCalledWith(`{"id":4,"method":"mining.set_difficulty","params":[512]}\n`, expect.any(Function)); expect(socket.write).toHaveBeenCalledWith(`{"id":null,"method":"mining.set_difficulty","params":[512]}\n`, expect.any(Function));
}); });
it('should set difficulty', async () => { it('should set difficulty', async () => {
@@ -31,7 +31,7 @@ export class SuggestDifficulty extends StratumBaseMessage {
public response(difficulty: number) { public response(difficulty: number) {
return { return {
id: this.id, id: null,
method: eResponseMethod.SET_DIFFICULTY, method: eResponseMethod.SET_DIFFICULTY,
params: [difficulty] params: [difficulty]
} }