mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 21:59:10 +02:00
refactor: Use uint64_t over size_t for serialized-size values
The values are small enough to fit in size_t, but to avoid having to think about it, just use uint64_t consistently for all architectures. On 64-bit systems, this refactor is a no-op. On 32-bit systems, it could avoid bugs in the theoretical and unexpected case where a 32-bit size_t is too small and overflows.
This commit is contained in:
@@ -2033,7 +2033,7 @@ static RPCHelpMan getblockstats()
|
||||
for (const CTxOut& out : tx->vout) {
|
||||
tx_total_out += out.nValue;
|
||||
|
||||
size_t out_size = GetSerializeSize(out) + PER_UTXO_OVERHEAD;
|
||||
uint64_t out_size{GetSerializeSize(out) + PER_UTXO_OVERHEAD};
|
||||
utxo_size_inc += out_size;
|
||||
|
||||
// The Genesis block and the repeated BIP30 block coinbases don't change the UTXO
|
||||
@@ -2085,7 +2085,7 @@ static RPCHelpMan getblockstats()
|
||||
const CTxOut& prevoutput = coin.out;
|
||||
|
||||
tx_total_in += prevoutput.nValue;
|
||||
size_t prevout_size = GetSerializeSize(prevoutput) + PER_UTXO_OVERHEAD;
|
||||
uint64_t prevout_size{GetSerializeSize(prevoutput) + PER_UTXO_OVERHEAD};
|
||||
utxo_size_inc -= prevout_size;
|
||||
utxo_size_inc_actual -= prevout_size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user