From 6698d2ce890ea2623f2a55241bd0000cb81671b9 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 27 May 2016 02:04:15 +0400 Subject: [PATCH] Re-enable FillBlockPayee for mnpayments, fix CreateNewBlock calculations (#811) * Reenable FillBlockPayee for mnpayments, fix CreateNewBlock calculations * revert blockchain.py fix #772 --- qa/rpc-tests/blockchain.py | 4 ++-- src/masternode-payments.cpp | 3 ++- src/miner.cpp | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/qa/rpc-tests/blockchain.py b/qa/rpc-tests/blockchain.py index 99c72002e8bb7..61df75c2738ea 100755 --- a/qa/rpc-tests/blockchain.py +++ b/qa/rpc-tests/blockchain.py @@ -49,11 +49,11 @@ def _test_gettxoutsetinfo(self): node = self.nodes[0] res = node.gettxoutsetinfo() - assert_equal(res[u'total_amount'], Decimal('98178.57142879')) + assert_equal(res[u'total_amount'], Decimal('98214.28571450')) assert_equal(res[u'transactions'], 200) assert_equal(res[u'height'], 200) assert_equal(res[u'txouts'], 200) - assert_equal(res[u'bytes_serialized'], 14277), + assert_equal(res[u'bytes_serialized'], 14273), assert_equal(len(res[u'bestblock']), 64) assert_equal(len(res[u'hash_serialized']), 64) diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 8f35b50506607..9f4b8c7f143f4 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -284,6 +284,7 @@ void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees) // } else { // mnpayments.FillBlockPayee(txNew, nFees); // } + mnpayments.FillBlockPayee(txNew, nFees); } std::string GetRequiredPaymentsString(int nBlockHeight) @@ -336,7 +337,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, CAmount nFe ExtractDestination(payee, address1); CBitcoinAddress address2(address1); - LogPrintf("Masternode payment to %s\n", address2.ToString()); + LogPrintf("Masternode payment %d to %s\n", masternodePayment, address2.ToString()); } } diff --git a/src/miner.cpp b/src/miner.cpp index 58b7b1b244334..7d94fe9786f2a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -286,7 +286,8 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& s LogPrintf("CreateNewBlock(): total size %u txs: %u fees: %ld sigops %d\n", nBlockSize, nBlockTx, nFees, nBlockSigOps); // Compute final coinbase transaction. - txNew.vout[0].nValue = nFees + GetBlockSubsidy(pindexPrev->nBits, nHeight, chainparams.GetConsensus()); + // Should already be calculated in FillBlockPayee + // txNew.vout[0].nValue = nFees + GetBlockSubsidy(pindexPrev->nBits, nHeight, chainparams.GetConsensus()); txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; pblock->vtx[0] = txNew; pblocktemplate->vTxFees[0] = -nFees;