mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-25 22:39:13 +02:00
validationcaches: Add and use ValidationCacheSizes
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(), modify log line to
no longer allude to maxsigcachesize being split evenly between the two
validation caches.
- 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 commit is contained in:
20
src/kernel/validation_cache_sizes.h
Normal file
20
src/kernel/validation_cache_sizes.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2022 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_KERNEL_VALIDATION_CACHE_SIZES_H
|
||||
#define BITCOIN_KERNEL_VALIDATION_CACHE_SIZES_H
|
||||
|
||||
#include <script/sigcache.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
namespace kernel {
|
||||
struct ValidationCacheSizes {
|
||||
int64_t signature_cache_bytes{DEFAULT_MAX_SIG_CACHE_BYTES / 2};
|
||||
int64_t script_execution_cache_bytes{DEFAULT_MAX_SIG_CACHE_BYTES / 2};
|
||||
};
|
||||
}
|
||||
|
||||
#endif // BITCOIN_KERNEL_VALIDATION_CACHE_SIZES_H
|
||||
Reference in New Issue
Block a user