sv1-sv2 routing

This commit is contained in:
Ben
2026-06-05 23:44:00 -04:00
parent 3d6c8b3134
commit fb367ac5f0
2 changed files with 16 additions and 0 deletions
+9
View File
@@ -157,6 +157,15 @@ describe('StratumV1Service', () => {
expect((service as any).detectProtocol(firstChunk)).toBe('v1');
});
it('should detect JSON-RPC as Stratum V1 even with non-printable trailing bytes', () => {
const firstChunk = Buffer.concat([
Buffer.from('{"id": 1, "method": "mining.subscribe", "params": []}\n'),
Buffer.from([0x00, 0xff])
]);
expect((service as any).detectProtocol(firstChunk)).toBe('v1');
});
it('should detect binary Noise traffic as Stratum V2', () => {
const firstChunk = Buffer.concat([
Buffer.from([0x01, 0x02, 0x03, 0x04]),