Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexander Blair
2017-02-21 08:25:17 -08:00
3 changed files with 14 additions and 5 deletions
+2 -2
View File
@@ -50,8 +50,8 @@ Deployment via Installer
1. Add your user to `/etc/sudoers`, this must be done so the script can sudo up and do it's job. We suggest passwordless sudo. Suggested line: `<USER> ALL=(ALL) NOPASSWD:ALL`. Our sample builds use: `pooldaemon ALL=(ALL) NOPASSWD:ALL`
2. Run the [deploy script](https://raw.githubusercontent.com/Snipa22/nodejs-pool/master/deployment/deploy.bash) as a **NON-ROOT USER**. This is very important! This script will install the pool to whatever user it's running under! Also. Go get a coffee, this sucker bootstraps the monero installation.
3. Once it's complete, copy `config_example.json` to `config.json` and change as appropriate. It is pre-loaded for a local install of everything, running on 127.0.0.1. This will work perfectly fine if you're using a single node setup. You will also want to run: source ~/.bashrc This will activate NVM and get things working for the following pm2 steps.
4. You'll need to change the API end point for the frontend code in the `xmrpoolui/app/utils/services.js` -- This will usually be `http://<your server ip>/api` unless you tweak caddy!
3. Once it's complete, change as `config.json` appropriate. It is pre-loaded for a local install of everything, running on 127.0.0.1. This will work perfectly fine if you're using a single node setup. You will also want to run: source ~/.bashrc This will activate NVM and get things working for the following pm2 steps.
4. You'll need to change the API end point for the frontend code in the `poolui/app/utils/services.js` -- This will usually be `http://<your server ip>/api` unless you tweak caddy!
5. Change the `db_storage_path` in `config.json` for your database directory to: `/home/<username>/pool_db/` The directory's already been created during startup. Or change as appropriate! Just make sure your user has write permissions, then run: `pm2 restart api` to reload the API for usage You'll also want to set `bind_ip` to the external IP of the pool server, and hostname to the resolvable hostname for the pool server. `pool_id` is mostly used for multi-server installations to provide unique identifiers in the backend.
6. Hop into the web interface (Should be at `http://<your server IP>/#/admin`), then login with `Administrator/Password123`, **MAKE SURE TO CHANGE THIS PASSWORD ONCE YOU LOGIN**. *<- This step is currently not active, we're waiting for the frontend to catch up! Head down to the Manual SQL Configuration to take a look at what needs to be done by hand for now*.
7. From the admin panel, you can configure all of your pool's settings for addresses, payment thresholds, etc.
+2
View File
@@ -33,6 +33,8 @@ function Coin(data){
this.intPrefix = 54;
}
this.niceHashDiff = 90000;
this.getBlockHeaderByID = function(blockId, callback){
global.support.rpcDaemon('getblockheaderbyheight', {"height": blockId}, function (body) {
if (body.hasOwnProperty('result')){
+10 -3
View File
@@ -184,7 +184,7 @@ let VarDiff = (function () {
};
})();
function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVersion, portType, port) {
function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVersion, portType, port, agent) {
// Username Layout - <address in BTC or XMR>.<Difficulty>
// Password Layout - <password>.<miner identifier>.<payment ID for XMR>
// Default function is to use the password so they can login. Identifiers can be unique, payment ID is last.
@@ -195,6 +195,9 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
let pass_split = pass.split(":");
this.error = "";
this.identifier = pass_split[0];
if (agent.includes('MinerGate')){
this.identifier = "MinerGate";
}
this.paymentID = null;
this.valid_miner = true;
this.port = port;
@@ -220,6 +223,10 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
this.fixed_diff = false;
this.difficulty = startingDiff;
this.connectTime = Date.now();
if (agent.includes('NiceHash')){
this.fixed_diff = true;
this.difficulty = global.coinFuncs.niceHashDiff;
}
if (diffSplit.length === 2) {
this.fixed_diff = true;
this.difficulty = Number(diffSplit[1]);
@@ -568,13 +575,13 @@ function handleMinerData(method, params, ip, portData, sendReply, pushMessage) {
}
switch (method) {
case 'login':
if (!params.login || !params.pass) {
if (!params.login || (!params.pass && !params.agent.includes('MinerGate'))) {
sendReply("No login/password specified");
return;
}
let difficulty = portData.difficulty;
let minerId = uuidV4();
miner = new Miner(minerId, params.login, params.pass, ip, difficulty, pushMessage, 1, portData.portType, portData.port);
miner = new Miner(minerId, params.login, params.pass, ip, difficulty, pushMessage, 1, portData.portType, portData.port, params.agent);
if (!miner.valid_miner) {
console.log("Invalid miner, disconnecting due to: " + miner.error);
sendReply(miner.error);