diff --git a/src/cuckoocache.h b/src/cuckoocache.h index e25f691341f..a064607537c 100644 --- a/src/cuckoocache.h +++ b/src/cuckoocache.h @@ -329,7 +329,7 @@ public: /** setup initializes the container to store no more than new_size * elements and no less than 2 elements. * - * setup should only be called once. + * setup should only be called once. TestOnlyReset() is the exception. * * @param new_size the desired number of elements to store * @returns the maximum number of elements storable @@ -483,6 +483,14 @@ public: } return false; } + + /** Empty the cache and re-run setup(). */ + void TestOnlyReset() + { + table.clear(); + epoch_flags.clear(); + setup(0); + } }; } // namespace CuckooCache diff --git a/src/test/fuzz/CMakeLists.txt b/src/test/fuzz/CMakeLists.txt index 3e1b5a09114..4d0695a7780 100644 --- a/src/test/fuzz/CMakeLists.txt +++ b/src/test/fuzz/CMakeLists.txt @@ -30,6 +30,7 @@ add_executable(fuzz cmpctblock.cpp coins_view.cpp coinscache_sim.cpp + connect_block.cpp connman.cpp crypto.cpp crypto_aes256.cpp diff --git a/src/test/fuzz/connect_block.cpp b/src/test/fuzz/connect_block.cpp new file mode 100644 index 00000000000..7c70dce173c --- /dev/null +++ b/src/test/fuzz/connect_block.cpp @@ -0,0 +1,480 @@ +// Copyright (c) 2026-present The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include