Skip to content

Commit 6aa99dd

Browse files
committed
Use proxyTarget for all proxy-related retarget branches
1 parent 9ff9e45 commit 6aa99dd

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

lib/pool/miners.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,19 +404,25 @@ module.exports = function createMinerFactory(deps) {
404404
let minDiff;
405405
let historyTime;
406406
const proxyMiner = state.proxyMiners[proxyMinerName];
407-
if (proxyMiner && proxyMiner.hashes / (timeNow - proxyMiner.connectTime) > miner.difficulty) {
407+
const proxyTarget = 15;
408+
let proxyDiff = 0;
409+
if (proxyMiner) {
410+
const proxyPeriod = (timeNow - proxyMiner.connectTime) / 1000;
411+
if (proxyPeriod > 0) proxyDiff = proxyMiner.hashes * proxyTarget / proxyPeriod;
412+
}
413+
if (proxyMiner && proxyDiff > miner.difficulty) {
408414
source = proxyMiner;
409-
target = 15;
415+
target = proxyTarget;
410416
minDiff = 10 * global.config.pool.minDifficulty;
411417
historyTime = 5;
412418
} else if (miner.payout in state.minerWallets && state.minerWallets[miner.payout].last_ver_shares >= global.config.pool.minerThrottleSharePerSec * global.config.pool.minerThrottleShareWindow) {
413419
source = state.minerWallets[miner.payout];
414-
target = 15;
420+
target = proxyTarget;
415421
minDiff = 10 * global.config.pool.minDifficulty;
416422
historyTime = 5;
417423
} else {
418424
source = miner;
419-
target = miner.proxy ? 15 : global.config.pool.targetTime;
425+
target = miner.proxy ? proxyTarget : global.config.pool.targetTime;
420426
minDiff = miner.proxy ? 10 * global.config.pool.minDifficulty : global.config.pool.minDifficulty;
421427
historyTime = 60;
422428
}

0 commit comments

Comments
 (0)