init: Use size_t consistently for cache sizes

This avoids having to rely on implicit casts when passing them to the
various functions allocating the caches.

This also ensures that if the requested amount of db_cache does not fit
in a size_t, it is clamped to the maximum value of a size_t.

Also take this opportunity to make the total amounts of cache in the
chainstate manager a size_t too.
This commit is contained in:
TheCharlatan
2024-12-17 21:58:47 +01:00
parent 65cde3621d
commit 2a92702baf
10 changed files with 38 additions and 29 deletions

View File

@@ -1067,11 +1067,11 @@ public:
//! The total number of bytes available for us to use across all in-memory
//! coins caches. This will be split somehow across chainstates.
int64_t m_total_coinstip_cache{0};
size_t m_total_coinstip_cache{0};
//
//! The total number of bytes available for us to use across all leveldb
//! coins databases. This will be split somehow across chainstates.
int64_t m_total_coinsdb_cache{0};
size_t m_total_coinsdb_cache{0};
//! Instantiate a new chainstate.
//!