aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-11-17 14:14:41 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-11-17 14:14:51 +0100
commitf6db48ad1c8ffe5230488a2a6cab5b62ab0a1207 (patch)
tree84618cb3589a49eff482d945209603712371cfda /src/miner.cpp
parentcb2ed300a89ebf9f0654da869ced665ed8b2abe7 (diff)
parent5f274a1749acfdf331bc2931e25ac80c346e5faa (diff)
downloadbitcoin-f6db48ad1c8ffe5230488a2a6cab5b62ab0a1207.tar.xz
Merge #8838: Calculate size and weight of block correctly in CreateNewBlock()
5f274a1 log block size and weight correctly. (jnewbery)
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index ebf2f21ffd..6ad63207cc 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -169,7 +169,6 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
nLastBlockTx = nBlockTx;
nLastBlockSize = nBlockSize;
nLastBlockWeight = nBlockWeight;
- LogPrintf("CreateNewBlock(): total size %u txs: %u fees: %ld sigops %d\n", nBlockSize, nBlockTx, nFees, nBlockSigOpsCost);
// Create coinbase transaction.
CMutableTransaction coinbaseTx;
@@ -183,6 +182,9 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
pblocktemplate->vchCoinbaseCommitment = GenerateCoinbaseCommitment(*pblock, pindexPrev, chainparams.GetConsensus());
pblocktemplate->vTxFees[0] = -nFees;
+ uint64_t nSerializeSize = GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION);
+ LogPrintf("CreateNewBlock(): total size: %u block weight: %u txs: %u fees: %ld sigops %d\n", nSerializeSize, GetBlockWeight(*pblock), nBlockTx, nFees, nBlockSigOpsCost);
+
// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);