|
1 | 1 | var net = require('net');
|
2 | 2 | var events = require('events');
|
3 | 3 |
|
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 |
6 | 6 |
|
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'); |
8 | 11 |
|
9 |
| -exports.daemon = require('./daemon.js'); |
10 |
| -exports.varDiff = require('./varDiff.js'); |
| 12 | +exports.daemon = daemon; |
| 13 | +exports.varDiff = varDiff; |
11 | 14 |
|
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); |
15 | 26 | return newPool;
|
16 | 27 | };
|
0 commit comments