This commit is contained in:
Matt 2014-04-05 14:19:43 -06:00
commit 0313b19036
2 changed files with 26 additions and 14 deletions

View File

@ -153,6 +153,12 @@ var pool = Stratum.createPool({
/* Sometimes you want the block hashes even for shares that aren't block candidates. */
"emitInvalidBlockHashes": false,
/* We use proper maximum algorithm difficulties found in the coin daemon source code. Most
miners/pools that deal with scrypt use a guesstimated one that is about 5.86% off from the
actual one. So here we can set a tolerable threshold for if a share is slightly too low
due to mining apps using incorrect max diffs and this pool using correct max diffs. */
"shareVariancePercent": 10,
/* If a worker is submitting a good deal of invalid shares we can temporarily ban them to
reduce system/network load. Also useful to fight against flooding attacks. */
"banning": {
@ -309,14 +315,14 @@ Donations
---------
To support development of this project feel free to donate :)
* BTC: 1KRotMnQpxu3sePQnsVLRy3EraRFYfJQFR
* LTC: LKfavSDJmwiFdcgaP1bbu46hhyiWw5oFhE
* VTC: VgW4uFTZcimMSvcnE4cwS3bjJ6P8bcTykN
* MAX: mWexUXRCX5PWBmfh34p11wzS5WX2VWvTRT
* QRK: QehPDAhzVQWPwDPQvmn7iT3PoFUGT7o8bC
* DRK: XcQmhp8ANR7okWAuArcNFZ2bHSB81jpapQ
* DOGE: DBGGVtwAAit1NPZpRm5Nz9VUFErcvVvHYW
* Cryptsy Trade Key: 254ca13444be14937b36c44ba29160bd8f02ff76
* BTC: `1KRotMnQpxu3sePQnsVLRy3EraRFYfJQFR`
* LTC: `LKfavSDJmwiFdcgaP1bbu46hhyiWw5oFhE`
* VTC: `VgW4uFTZcimMSvcnE4cwS3bjJ6P8bcTykN`
* MAX: `mWexUXRCX5PWBmfh34p11wzS5WX2VWvTRT`
* QRK: `QehPDAhzVQWPwDPQvmn7iT3PoFUGT7o8bC`
* DRK: `XcQmhp8ANR7okWAuArcNFZ2bHSB81jpapQ`
* DOGE: `DBGGVtwAAit1NPZpRm5Nz9VUFErcvVvHYW`
* Cryptsy Trade Key: `254ca13444be14937b36c44ba29160bd8f02ff76`
License
-------

View File

@ -182,8 +182,9 @@ var JobManager = module.exports = function JobManager(maxDifficulty, hashDigest,
var blockHash;
var blockHex;
var shareDiff = maxDifficulty.div(headerBigNum).toString();
var shareDiff = maxDifficulty.div(headerBigNum);
//Check if share is a block candidate (matched network difficulty)
if (job.target.ge(headerBigNum)){
blockHex = job.serializeBlock(headerBuffer, coinbaseBuffer).toString('hex');
blockHash = util.reverseBuffer(util.sha256d(headerBuffer)).toString('hex');
@ -192,20 +193,25 @@ var JobManager = module.exports = function JobManager(maxDifficulty, hashDigest,
if (options.emitInvalidBlockHashes)
blockHashInvalid = util.reverseBuffer(util.sha256d(headerBuffer)).toString('hex');
//Difficulty the miner is set to
var targetUser = maxDifficulty.div(difficulty);
//Check if share didn't reached the miner's difficulty)
if (headerBigNum.gt(targetUser)){
//Check if share matched a previous difficulty from before vardiff retarget
//Check if share matched a previous difficulty from before a vardiff retarget
if (previousDifficulty && !headerBigNum.gt(maxDifficulty.div(previousDifficulty))){
difficulty = previousDifficulty;
}
else{
var offPercent = targetUser.div(headerBigNum).toNumber() * 100;
var offPercent = 100 - (shareDiff.toNumber() / difficulty) * 100;
if (offPercent > options.shareVariancePercent){
return shareError([23, 'low difficulty share of ' + shareDiff]);
//Check to see if low diff share is within acceptable configured range
if (offPercent > (options.shareVariancePercent || 0)){
return shareError([23, 'low difficulty share of ' + shareDiff.toString()]);
}
else{
_this.emit('log', 'warning', 'Share accepted a low diff ' + shareDiff + ' off by ' + (100 - offPercent).toFixed(2) + '%');
_this.emit('log', 'warning', 'Share accepted a low diff ' + shareDiff + ' off by ' + offPercent.toFixed(2) + '%');
}
}