Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1 align="center">Welcome to duino-pools 👋</h1>
<h1 align="center">Welcome to duino-coin-pools 👋</h1>
<p align ="center">
<img src="https://img.shields.io/badge/node-%3E%3D16.0.0-blue.svg?logo=node.js&logoColor=white" />
<img alt="Maintenance" src="https://img.shields.io/badge/maintained-yes-green.svg" />
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"node-os-utils": "^1.3.5",
"xxhashjs": "^0.2.2",
"chalk": "4.1.2",
"sync-request": "^6.1.0",
"form-data": "4.0.0"
}
}
19 changes: 11 additions & 8 deletions src/mining.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Duino-Coin Mining handler
For documention about these functions see
https://github.com/revoxhere/duino-coin/blob/useful-tools
2019-2022 Duino-Coin community */
2019-2023 Duino-Coin community */

const crypto = require("crypto");
const request = require('sync-request');
Expand All @@ -24,13 +24,14 @@ globalBlocks = [];
let workers = {};
let usrWorkers = {};
let minersStats = {};
let cachedItems = {};
let balancesToUpdate = {};
let globalShares = {
increase: 0,
total: 0,
};
if (!max_shares_per_minute) {
let max_shares_per_minute = 70;
let max_shares_per_minute = 80;
}

const getDiff = (poolRewards, textDiff) => {
Expand All @@ -47,8 +48,13 @@ const checkWorkers = (ipWorkers, usrWorkers, serverMiners, username) => {

if (Math.max(ipWorkers, usrWorkers, serverMiners) > maxWorkers) {
/* Check if user has worker limit upgrades */
res = request('GET', `https://server.duinocoin.com/v2/users/${username}`)
userItems = JSON.parse(res.getBody('utf8')).result.items;
if (!cachedItems.hasOwnProperty(username) && getRand(50) != 10) {
res = request('GET', `https://server.duinocoin.com/v2/users/${username}`)
userItems = JSON.parse(res.getBody('utf8')).result.items;
cachedItems[username] = userItems;
} else {
userItems = cachedItems[username];
}

if (userItems.includes(10) && userItems.includes(11)) {
if (Math.max(ipWorkers, usrWorkers, serverMiners) > 125) {
Expand Down Expand Up @@ -150,8 +156,6 @@ const miningHandler = async (conn, data, mainListener, usingAVR) => {
data = data.split(",");
conn.ping = (new Date() - feedback_sent) / 1000;

if (data[1] != username) conn.reject_shares = "Username changed";

if (conn.overrideDifficulty)
reqDifficulty = conn.overrideDifficulty;
else if (usingAVR) reqDifficulty = "AVR";
Expand Down Expand Up @@ -247,10 +251,9 @@ const miningHandler = async (conn, data, mainListener, usingAVR) => {

conn.lastminshares++;

let miner_res = parseInt(answer[0]);
if (usingAVR) {
miner_res = parseInt(answer[0], 2);
} else {
miner_res = parseInt(answer[0]);
}

/* try {
Expand Down