-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (30 loc) · 1.03 KB
/
index.js
File metadata and controls
39 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const Pool = require("./src/index");
const config = require("./config");
const pool = new Pool(config, (ip, port , workerName, password, callback) => {
console.log("Authorize " + workerName + ":" + password + "@" + ip);
callback({
error: null,
authorized: true,
disconnect: false
});
});
pool.on("share", function(isValidShare, isValidBlock, data){
if (isValidBlock)
console.log("Block found");
else if (isValidShare)
console.log("Valid share submitted");
else if (data.blockHash)
console.log("We thought a block was found but it was rejected by the daemon");
else
console.log("Invalid share submitted");
console.log("share data: " + JSON.stringify(data));
});
/*
'severity': can be 'debug', 'warning', 'error'
'logKey': can be 'system' or 'client' indicating if the error
was caused by our system or a stratum client
*/
pool.on("log", function(severity, logText){
console.log("[" + severity + "]: " + logText);
});
pool.StartInDefault();