diff --git a/lib/shareProcessor.js b/lib/shareProcessor.js index a197b88..d34c524 100644 --- a/lib/shareProcessor.js +++ b/lib/shareProcessor.js @@ -163,7 +163,7 @@ var ShareProcessor = module.exports = function ShareProcessor(config, logger){ var transactions = block.transactions; var coinbaseTx = transactions[transactions.length - 1]; - var index = block.ghostUncles.findIndex((u) => u.hash === ghostUncleHash) + var index = block.ghostUncles.findIndex((u) => u.blockHash === ghostUncleHash) var rewardOutput = coinbaseTx.unsigned.fixedOutputs[index + 1]; var rewardAmount = rewardOutput.attoAlphAmount; logger.info('Found main chain block ' + block.hash + ', uncle reward: ' + rewardAmount); diff --git a/test/shareProcessorTest.js b/test/shareProcessorTest.js index 391d581..dd13f3f 100644 --- a/test/shareProcessorTest.js +++ b/test/shareProcessorTest.js @@ -134,7 +134,7 @@ describe('test share processor', function(){ var ghostUncleBlock = {hash: 'block1', height: 1, chainFrom: 0, chainTo: 0, transactions: ghostUncleCoinbaseTx, inMainChain: false, submittedMs: currentMs, ghostUncles: []} var mainChainCoinbaseTx = [{unsigned:{fixedOutputs:[{attoAlphAmount: rewardAmount},{attoAlphAmount: ghostUncleRewardAmount}]}}]; - var mainChainBlock = {hash: 'block2', height: 2, chainFrom: 0, chainTo: 0, transactions: mainChainCoinbaseTx, inMainChain: true, submittedMs: currentMs, ghostUncles: [{hash:ghostUncleBlock.hash}]} + var mainChainBlock = {hash: 'block2', height: 2, chainFrom: 0, chainTo: 0, transactions: mainChainCoinbaseTx, inMainChain: true, submittedMs: currentMs, ghostUncles: [{blockHash:ghostUncleBlock.hash}]} var blocks = [ghostUncleBlock, mainChainBlock] function prepare(blocks, callback){