| 550 | } |
| 551 | |
| 552 | function recordShareData(miner, job, shareDiff, blockCandidate, hashHex, shareType, blockTemplate) { |
| 553 | miner.hashes += job.difficulty; |
| 554 | global.database.storeShare(job.height, global.protos.Share.encode({ |
| 555 | shares: job.difficulty, |
| 556 | paymentAddress: miner.address, |
| 557 | paymentID: miner.paymentID, |
| 558 | foundBlock: blockCandidate, |
| 559 | trustedShare: shareType, |
| 560 | poolType: miner.poolTypeEnum, |
| 561 | poolID: global.config.pool_id, |
| 562 | blockDiff: activeBlockTemplate.difficulty, |
| 563 | bitcoin: miner.bitcoin, |
| 564 | blockHeight: job.height, |
| 565 | timestamp: Date.now(), |
| 566 | identifier: miner.identifier |
| 567 | })); |
| 568 | if (blockCandidate) { |
| 569 | global.database.storeBlock(job.height, global.protos.Block.encode({ |
| 570 | hash: hashHex, |
| 571 | difficulty: blockTemplate.difficulty, |
| 572 | shares: 0, |
| 573 | timestamp: Date.now(), |
| 574 | poolType: miner.poolTypeEnum, |
| 575 | unlocked: false, |
| 576 | valid: true |
| 577 | })); |
| 578 | } |
| 579 | if (shareType) { |
| 580 | process.send({type: 'trustedShare'}); |
| 581 | debug(threadName + "Accepted trusted share at difficulty: " + job.difficulty + "/" + shareDiff + " from: " + miner.logString); |
| 582 | } else { |
| 583 | process.send({type: 'normalShare'}); |
| 584 | debug(threadName + "Accepted valid share at difficulty: " + job.difficulty + "/" + shareDiff + " from: " + miner.logString); |
| 585 | } |
| 586 | |
| 587 | } |
| 588 | |
| 589 | function processShare(miner, job, blockTemplate, params) { |
| 590 | let nonce = params.nonce; |