Skip to content

Commit af3451d

Browse files
Update index.js
1 parent 37a4541 commit af3451d

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

lib/index.js

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
var net = require('net');
22
var events = require('events');
33

4-
//Gives us global access to everything we need for each hashing algorithm
5-
require('./algoProperties.js');
4+
// Ensure global access to algorithm properties if needed
5+
require('./algoProperties.js'); // Ensure documentation explains why this is needed globally
66

7-
var pool = require('./pool.js');
7+
// Import pool and daemon functionality
8+
var Pool = require('./pool.js');
9+
var daemon = require('./daemon.js');
10+
var varDiff = require('./varDiff.js');
811

9-
exports.daemon = require('./daemon.js');
10-
exports.varDiff = require('./varDiff.js');
12+
exports.daemon = daemon;
13+
exports.varDiff = varDiff;
1114

12-
13-
exports.createPool = function(poolOptions, authorizeFn){
14-
var newPool = new pool(poolOptions, authorizeFn);
15+
/**
16+
* Create a new mining pool with given options and authorization function.
17+
* @param {Object} poolOptions - Configuration options for the pool
18+
* @param {Function} authorizeFn - Function to authorize mining clients
19+
* @returns {Pool} A new pool instance
20+
*/
21+
exports.createPool = function(poolOptions, authorizeFn) {
22+
if (!poolOptions || typeof authorizeFn !== 'function') {
23+
throw new Error("Invalid poolOptions or authorizeFn");
24+
}
25+
var newPool = new Pool(poolOptions, authorizeFn);
1526
return newPool;
1627
};

0 commit comments

Comments
 (0)