forked from dvandal/cryptonote-nodejs-pool
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·63 lines (58 loc) · 1.87 KB
/
index.js
File metadata and controls
executable file
·63 lines (58 loc) · 1.87 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env node
/**
* Solo Mining Bridge Entry Point
*
* Usage:
* node index.js --solo-mining # Start solo mining bridge
* node index.js --solo-mining --health # Run health check and exit
* node index.js --solo-mining --debug # Start with debug logging enabled
*
* This starts a minimal stratum server that connects miners to your local daemon
* for solo mining. No Redis, no payments, no API - just job distribution and block submission.
*/
// Check for flags
var poolMode = false;
var soloMode = false;
var healthCheck = false;
var debugMode = false;
for (var i = 2; i < process.argv.length; i++) {
if (process.argv[i] === '--pool') {
poolMode = true;
}
if (process.argv[i] === '--solo-mining') {
soloMode = true;
}
if (process.argv[i] === '--health') {
healthCheck = true;
}
if (process.argv[i] === '--debug') {
debugMode = true;
}
}
// Require at least one mode argument
if (!poolMode && !soloMode) {
console.error('Error: No mode specified.');
console.error('');
console.error('Usage:');
console.error(' node index.js --pool # Start full mining pool');
console.error(' node index.js --solo-mining # Start solo mining bridge');
console.error(' node index.js --solo-mining --health # Run health check and exit');
console.error(' node index.js --solo-mining --debug # Start with debug logging');
console.error('');
process.exit(1);
}
// Set global debug flag for solo bridge
if (soloMode) {
global.SOLO_DEBUG = debugMode;
}
if (poolMode) {
// Full pool mode
require('./init.js');
} else if (healthCheck) {
// Health check mode - one-off probe then exit
require('./lib/soloHealth.js');
} else {
// Solo mining mode
console.log('Starting solo mining bridge...');
require('./lib/soloBridge.js');
}