Calculate size and weight of block correctly in CreateNewBlock()#8838
Calculate size and weight of block correctly in CreateNewBlock()#8838laanwj merged 1 commit intobitcoin:masterfrom
Conversation
|
Log entries that change their format are really bad for tooling. Is there any reason why it's bad to log limits that are at their maximum because they're not being applied? |
|
The current code is not logging
That means that if size is not being accounted, CreateNewBlock always logs that a block of size 1000 (bytes) has been created. I don't think we should just change the log to output size = 1000000 if size isn't being accounted. I propose the following change:
|
|
Maybe @gmaxwell's concern can be addressed by logging 'total size ?' |
|
Alternatively, you can always just compute the total block size using ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION). |
00daa67 to
5f274a1
Compare
|
Updated to always calculate size and weight correctly (whether or not size is being accounted). I'll update the description of this PR. |
|
utACK |
|
@laanwj - this PR fixes a bug where bitcoin logs incorrect sizes for new blocks. Is there anything I can do to help this get merged? |
…wBlock() 5f274a1 log block size and weight correctly. (jnewbery)
|
Backported in #9264, removing tag. |
Github-Pull: bitcoin#8838 Rebased-From: 5f274a1
bitcoind writes the following log when it's created a new block:
CreateNewBlock(): total size _ txs: _ fees: _ sigops _If this is post-segwit and the miner is counting weight and not block size, then the size field will be incorrect (it will always be set to 1000).
This PR fixes the log in the following way:
I've run all tests and manually verified that the log output is correct when using the
blockmaxsizeandblockmaxweightcommand line parameters.