mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-12-04 12:13:59 +01:00
Adding todos to re-implement coin functions within the coins/coin.js file.
This commit is contained in:
@@ -16,6 +16,7 @@ let lastBlock = 0;
|
|||||||
let balanceIDCache = {};
|
let balanceIDCache = {};
|
||||||
let blockScannerTask;
|
let blockScannerTask;
|
||||||
let blockQueue = async.queue(function (task, callback) {
|
let blockQueue = async.queue(function (task, callback) {
|
||||||
|
// Todo: Implement within the coins/<coin>.js file.
|
||||||
global.support.rpcDaemon('getblockheaderbyheight', {"height": task.blockID}, function (body) {
|
global.support.rpcDaemon('getblockheaderbyheight', {"height": task.blockID}, function (body) {
|
||||||
let blockData = body.result.block_header;
|
let blockData = body.result.block_header;
|
||||||
if (blockData.hash in blockHexCache) {
|
if (blockData.hash in blockHexCache) {
|
||||||
@@ -397,9 +398,11 @@ function blockUnlocker() {
|
|||||||
}
|
}
|
||||||
debug("Running block unlocker");
|
debug("Running block unlocker");
|
||||||
let blockList = global.database.getValidLockedBlocks();
|
let blockList = global.database.getValidLockedBlocks();
|
||||||
|
// Todo: Implement within the coins/<coin>.js file.
|
||||||
global.support.rpcDaemon('getlastblockheader', [], function (body) {
|
global.support.rpcDaemon('getlastblockheader', [], function (body) {
|
||||||
let blockHeight = body.result.block_header.height;
|
let blockHeight = body.result.block_header.height;
|
||||||
blockList.forEach(function (row) {
|
blockList.forEach(function (row) {
|
||||||
|
// Todo: Implement within the coins/<coin>.js file.
|
||||||
global.support.rpcDaemon('getblockheaderbyheight', {"height": row.height}, function (body) {
|
global.support.rpcDaemon('getblockheaderbyheight', {"height": row.height}, function (body) {
|
||||||
if (body.result.block_header.hash !== row.hash) {
|
if (body.result.block_header.hash !== row.hash) {
|
||||||
global.database.invalidateBlock(row.height);
|
global.database.invalidateBlock(row.height);
|
||||||
|
|||||||
@@ -622,6 +622,7 @@ function processShare(miner, job, blockTemplate, params) {
|
|||||||
|
|
||||||
if (hashDiff.ge(blockTemplate.difficulty)) {
|
if (hashDiff.ge(blockTemplate.difficulty)) {
|
||||||
// Submit block to the RPC Daemon.
|
// Submit block to the RPC Daemon.
|
||||||
|
// Todo: Implement within the coins/<coin>.js file.
|
||||||
global.support.rpcDaemon('submitblock', [shareBuffer.toString('hex')], function (rpcResult) {
|
global.support.rpcDaemon('submitblock', [shareBuffer.toString('hex')], function (rpcResult) {
|
||||||
if (rpcResult.error) {
|
if (rpcResult.error) {
|
||||||
// Did not manage to submit a block. Log and continue on.
|
// Did not manage to submit a block. Log and continue on.
|
||||||
|
|||||||
@@ -431,6 +431,7 @@ function updatePoolInformation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateBlockHeader() {
|
function updateBlockHeader() {
|
||||||
|
// Todo: Implement within the coins/<coin>.js file.
|
||||||
global.support.rpcDaemon('getlastblockheader', [], function (body) {
|
global.support.rpcDaemon('getlastblockheader', [], function (body) {
|
||||||
if (typeof body.error !== 'undefined'){
|
if (typeof body.error !== 'undefined'){
|
||||||
return console.error(`Issue getting last block header: ${JSON.stringify(body)}`);
|
return console.error(`Issue getting last block header: ${JSON.stringify(body)}`);
|
||||||
@@ -455,6 +456,7 @@ function updateBlockHeader() {
|
|||||||
function updateWalletStats() {
|
function updateWalletStats() {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (callback) {
|
function (callback) {
|
||||||
|
// Todo: Implement within the coins/<coin>.js file.
|
||||||
global.support.rpcWallet('getbalance', [], function (body) {
|
global.support.rpcWallet('getbalance', [], function (body) {
|
||||||
if (body.result) {
|
if (body.result) {
|
||||||
return callback(null, {
|
return callback(null, {
|
||||||
@@ -468,10 +470,14 @@ function updateWalletStats() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
function (state, callback) {
|
function (state, callback) {
|
||||||
|
// Todo: Implement within the coins/<coin>.js file.
|
||||||
global.support.rpcWallet('getheight', [], function (body) {
|
global.support.rpcWallet('getheight', [], function (body) {
|
||||||
if (body.result) {
|
if (body.result) {
|
||||||
state.height = body.result.height;
|
state.height = body.result.height;
|
||||||
return callback(null, state);
|
return callback(null, state);
|
||||||
|
} else if (typeof body.error !== 'undefined' && body.error.message === 'Method not found') {
|
||||||
|
state.height = 0;
|
||||||
|
return callback(null, state);
|
||||||
} else {
|
} else {
|
||||||
return callback(true, "Unable to get current wallet height");
|
return callback(true, "Unable to get current wallet height");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user