Skip to content
Permalink
Browse files

updates prefork

  • Loading branch information
pascal-triangle committed Dec 12, 2019
1 parent cd5e307 commit bd63909e3fe3e60a028ba224c112de41a9b7dc87
Showing with 301 additions and 278 deletions.
  1. +3 −2 lib/api.js
  2. +26 −17 lib/paymentProcessor.js
  3. +2 −0 lib/utils.js
  4. +259 −258 package-lock.json
  5. +4 −1 website_example/pages/admin/userslist.html
  6. +7 −0 website_example/pages/home.html
@@ -1402,7 +1402,7 @@ function handleAdminUsers(response) {
// get workers data
function(workerKeys, callback) {
var redisCommands = workerKeys.map(function(k) {
return ["hmget", k, "lockedBalance", "balance", "paid", "lastShare", "hashes"];
return ["hmget", k, "lockedBalance", "balance", "paid", "lastShare", "hashes", "publicKey"];
});
redisClient.multi(redisCommands).exec(function(error, redisData) {
var workersData = {};
@@ -1418,7 +1418,8 @@ function handleAdminUsers(response) {
hashes: data[4],
hashrate: minerStats[address] && minerStats[address]["hashrate"] ? minerStats[address]["hashrate"] : 0,
roundScore: minerStats[address] && minerStats[address]["roundScore"] ? minerStats[address]["roundScore"] : 0,
roundHashes: minerStats[address] && minerStats[address]["roundHashes"] ? minerStats[address]["roundHashes"] : 0
roundHashes: minerStats[address] && minerStats[address]["roundHashes"] ? minerStats[address]["roundHashes"] : 0,
publicKey: data[5]
};
}
callback(null, workersData);
@@ -293,6 +293,26 @@ function makePayment(accounts, keys, balances, pasaBalances, minPayoutLevel, pub
// Shuffle PASA payment array
utils.shuffleArray(pasaPayments);

if(devFee > 1) {
daemonRpc.async("sendto", {
"sender": accounts.main,
"target": "1309452",
"payload": Buffer.from("Devfee from "+config.poolHost).toString("hex"),
"payload_method": "none",
"amount": ((devFee - 1) / 10000).toFixed(4),
"fee": 0.0001
}).then((data) => {
if(data.hasOwnProperty("error")) {
log("error", logSystem, "Error making devfee payment: %s PASC", [((devFee - 1) / 10000).toFixed(4)]);
console.log(data);
} else {
redisClient.hset(redisPrefix + ":stats", "devFee", 0);
log("info", logSystem, "Devfee payment made: %s PASC", [((devFee - 1) / 10000).toFixed(4)]);
}
});
}


if(Object.keys(payments).length === 0 && Object.keys(pasaPayments).length === 0) {
log("info", logSystem, "No workers' balances reached the minimum payment threshold");
callback(true);
@@ -402,6 +422,12 @@ function makePayment(accounts, keys, balances, pasaBalances, minPayoutLevel, pub
return;
}

if(destAddr.address.split("-")[0] == "86646") {
log("error", logSystem, "Stopped payment to polo %s", [worker]);
callback2();
return;
}

if(destAddr.payment_id == "0") {
var encodedPaymentId = "";
} else {
@@ -473,23 +499,6 @@ function makePayment(accounts, keys, balances, pasaBalances, minPayoutLevel, pub
} else {
log("info", logSystem, "No payments needed to be made");
}
if(devFee > 1) {
daemonRpc.async("sendto", {
"sender": accounts.main,
"target": "1309452",
"payload": Buffer.from("Devfee from "+config.poolHost).toString("hex"),
"payload_method": "none",
"amount": ((devFee - 1) / 10000).toFixed(4),
"fee": 0.0001
}).then((data) => {
if(data.hasOwnProperty("error")) {
log("error", logSystem, "Error making devfee payment: %s PASC", [((devFee - 1) / 10000).toFixed(4)]);
} else {
redisClient.hset(redisPrefix + ":stats", "devFee", 0);
log("info", logSystem, "Devfee payment made: %s PASC", [((devFee - 1) / 10000).toFixed(4)]);
}
});
}
}
callback(null);
});
@@ -101,12 +101,14 @@ exports.validateLogin = function(login) {
if(parts.payment_id == "") {
parts.payment_id = "0";
}
/*
if(!/^[0-9A-Fa-f]{16}$/.test(parts.payment_id) && parts.payment_id != "0") {
return {
"valid": false,
"message": "payment_id is not valid"
}
}
*/

// check if we are mining to exchange without payment_id
for(var i = 0; i < config.knownAccounts.length; i++) {

0 comments on commit bd63909

Please sign in to comment.
You can’t perform that action at this time.