From af3451d01e9a843e84149bae60590bc50716e0ef Mon Sep 17 00:00:00 2001 From: "ROZ a.k.a. Aoi Emerauda" Date: Tue, 30 Apr 2024 20:49:39 +0900 Subject: [PATCH] Update index.js --- lib/index.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/index.js b/lib/index.js index fd5b7bad8..1689e1e28 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,16 +1,27 @@ var net = require('net'); var events = require('events'); -//Gives us global access to everything we need for each hashing algorithm -require('./algoProperties.js'); +// Ensure global access to algorithm properties if needed +require('./algoProperties.js'); // Ensure documentation explains why this is needed globally -var pool = require('./pool.js'); +// Import pool and daemon functionality +var Pool = require('./pool.js'); +var daemon = require('./daemon.js'); +var varDiff = require('./varDiff.js'); -exports.daemon = require('./daemon.js'); -exports.varDiff = require('./varDiff.js'); +exports.daemon = daemon; +exports.varDiff = varDiff; - -exports.createPool = function(poolOptions, authorizeFn){ - var newPool = new pool(poolOptions, authorizeFn); +/** + * Create a new mining pool with given options and authorization function. + * @param {Object} poolOptions - Configuration options for the pool + * @param {Function} authorizeFn - Function to authorize mining clients + * @returns {Pool} A new pool instance + */ +exports.createPool = function(poolOptions, authorizeFn) { + if (!poolOptions || typeof authorizeFn !== 'function') { + throw new Error("Invalid poolOptions or authorizeFn"); + } + var newPool = new Pool(poolOptions, authorizeFn); return newPool; };