diff options
author | Carl Dong <contact@carldong.me> | 2022-07-01 00:08:14 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2022-08-03 12:03:28 -0400 |
commit | 0f3a2532c38074dd9789d1c4c667db6ca46ff0ab (patch) | |
tree | e45ce50c4efda6ac38aa3dfeeb18dae4e2ecc8d0 /src/script | |
parent | 41c5201a90bbc2893333e334e8945759ef24e7dd (diff) |
validationcaches: Use size_t for sizes
...also move the 0-clamping logic to ApplyArgsManOptions, where it
belongs.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/sigcache.cpp | 8 | ||||
-rw-r--r-- | src/script/sigcache.h | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp index 8e6971d3f3..e507ec7528 100644 --- a/src/script/sigcache.cpp +++ b/src/script/sigcache.cpp @@ -93,13 +93,9 @@ static CSignatureCache signatureCache; // To be called once in AppInitMain/BasicTestingSetup to initialize the // signatureCache. -bool InitSignatureCache(int64_t max_size_bytes) +bool InitSignatureCache(size_t max_size_bytes) { - // nMaxCacheSize is unsigned. If -maxsigcachesize is set to zero, - // setup_bytes creates the minimum possible cache (2 elements). - size_t nMaxCacheSize = std::max<int64_t>(max_size_bytes, 0); - - auto setup_results = signatureCache.setup_bytes(nMaxCacheSize); + auto setup_results = signatureCache.setup_bytes(max_size_bytes); if (!setup_results) return false; const auto [num_elems, approx_size_bytes] = *setup_results; diff --git a/src/script/sigcache.h b/src/script/sigcache.h index 4c1cad38a7..290955090d 100644 --- a/src/script/sigcache.h +++ b/src/script/sigcache.h @@ -32,6 +32,6 @@ public: bool VerifySchnorrSignature(Span<const unsigned char> sig, const XOnlyPubKey& pubkey, const uint256& sighash) const override; }; -[[nodiscard]] bool InitSignatureCache(int64_t max_size_bytes); +[[nodiscard]] bool InitSignatureCache(size_t max_size_bytes); #endif // BITCOIN_SCRIPT_SIGCACHE_H |