MCPcopy Create free account
hub / github.com/Snipa22/nodejs-pool / recordShareData

Function recordShareData

lib/pool.js:552–587  ·  view source on GitHub ↗
(miner, job, shareDiff, blockCandidate, hashHex, shareType, blockTemplate)

Source from the content-addressed store, hash-verified

550}
551
552function 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
589function processShare(miner, job, blockTemplate, params) {
590 let nonce = params.nonce;

Callers 1

processShareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected