HomePhabricator

validationcaches: Add and use ValidationCacheSizes

Description

validationcaches: Add and use ValidationCacheSizes

Summary:
Also:

  • Make DEFAULT_MAX_SIG_CACHE_SIZE into constexpr DEFAULT_MAX_SIG_CACHE_BYTES to utilize the compile-time integer arithmetic overflow checking available to constexpr.
  • Fix comment (MiB instead of MB) for DEFAULT_MAX_SIG_CACHE_BYTES.
  • Pass in max_size_bytes parameter to InitS*Cache()
  • Fix possible integer truncation and add a comment.

[META] I've kept the integer types as int64_t in order to not introduce unintended behaviour changes, in the next commit we will make them size_t.

This is a partial backport of core#25527
https://github.com/bitcoin/bitcoin/pull/25527/commits/41c5201a90bbc2893333e334e8945759ef24e7dd

Depends on D15737

Backport note: Bitcoin ABC has two separate options for script cache size and sig cache size, while Core uses a single value and assigns half for each cache.

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15738

Details

Provenance
Carl Dong <contact@carldong.me>Authored on Jul 1 2022, 03:47
PiRKCommitted on Mar 19 2024, 16:21
PiRKPushed on Mar 19 2024, 16:21
Reviewer
Restricted Project
Differential Revision
D15738: validationcaches: Add and use ValidationCacheSizes
Parents
rABCab5c81a17032: cuckoocache: Check for uint32 overflow in setup_bytes
Branches
Unknown
Tags
Unknown