mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-12 15:03:18 +02:00
5f36e0ff1erpc: fix getblockstats UTXO overhead accounting (Lőrinc)76190489e6coins: pack `Coin` height/coinbase consistently (Lőrinc)1f309d1aa2coins: make `Coin::fCoinBase` a bool (Lőrinc) Pull request description: The [`getblockstats` RPC](https://github.com/bitcoin/bitcoin/pull/10757) currently overestimates UTXO overhead by treating the `fCoinBase` bitfield as an additional `bool` in `PER_UTXO_OVERHEAD`. However, `fCoinBase` and `nHeight` are stored as bitfields and effectively packed into a single 32-bit value; counting an extra bool in the overhead calculation is unnecessary. This PR introduces the following changes across three commits: * Store `fCoinBase` as a `bool` bitfield to reduce implicit conversions at call sites. * Use a consistent height/coinbase packing style across `Coin` serialization, undo serialization, and coinstats hashing (casting `nHeight` to `uint32_t` before shifting to avoid signed-promotion UB). * Adjust UTXO overhead estimation to match the actual `Coin` layout and update the related tests accordingly. ACKs for top commit: achow101: ACK5f36e0ff1esedited: ACK5f36e0ff1evasild: ACK5f36e0ff1eoptout21: crACK5f36e0ff1eTree-SHA512: f4a44debed358e9e130da9d6fae5f89289daa34f0bdb7155edc3e9b691c219451f4c80b1e16aca5b011f0fa2fa975484ef1af4ca4563b7c6ba4ca9dd133f30be