aboutsummaryrefslogtreecommitdiff
path: root/src/test/validation_flush_tests.cpp
AgeCommit message (Collapse)Author
2023-03-23Use PoolAllocator for CCoinsMapMartin Leitner-Ankerl
In my benchmarks, using this pool allocator for CCoinsMap gives about 20% faster `-reindex-chainstate` with -dbcache=5000 with practically the same memory usage. The change in max RSS changed was 0.3%. The `validation_flush_tests` tests need to be updated because memory allocation is now done in large pools instead of one node at a time, so the limits need to be updated accordingly.
2023-03-23Call ReallocateCache() on each Flush()Martin Leitner-Ankerl
This frees up all associated memory with the map, not only the nodes. This is necessary in preparation for using the PoolAllocator for CCoinsMap, which does not actually free any memory on clear().
2023-02-09De-duplicate add_coin methods to a test util helperJon Atack
2023-02-09Create InsecureRandMoneyAmount() test util helperJon Atack
to generate semi-random CAmounts up to MAX_MONEY rather than only uint32, and use it in the unit tests.
2023-02-06Move random test util code from setup_common to randomJon Atack
as many of the unit tests don't use this code
2023-01-03refactor: use braced init for integer constants instead of c style castsPasta
2022-12-24scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: - 2021: f47dda2c58b5d8d623e0e7ff4e74bc352dfa83d7 - 2020: fa0074e2d82928016a43ca408717154a1c70a4db - 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2022-09-09scripted-diff: rename CChainState -> ChainstateJames O'Beirne
-BEGIN VERIFY SCRIPT- sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*') -END VERIFY SCRIPT- Co-authored-by: MacroFake <falke.marco@gmail.com>
2022-08-10validation tests: Use existing {Chainstate,Block}ManCarl Dong
Use {Chain,}TestingSetup's existing {Chainstate,Block}Manager and avoid unnecessarily creating a local one. This also helps reduce the code diff for a later commit where we change {Chainstate,Block}Manager's constructor signature.
2022-06-15scripted-diff: test: Use CTxMemPool in TestingSetupCarl Dong
After this commit, there should be no explicit instantiation of CTxMemPool in src/test other than those in fuzz/ and setup_common -BEGIN VERIFY SCRIPT- find_regex="CTxMemPool\s+([^;({]+)(|\(\)|\{\});" \ && git grep -l -E "$find_regex" -- src/test \ | grep -v -e "^src/test/util/setup_common.cpp$" \ -e "^src/test/fuzz/" \ | xargs sed -i -E "s@$find_regex@CTxMemPool\& \1 = *Assert(m_node.mempool);@g" -END VERIFY SCRIPT-
2022-01-06Add src/node/* code to node:: namespaceRussell Yanofsky
2021-12-30scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: * 2020: fa0074e2d82928016a43ca408717154a1c70a4db * 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2021-11-19scripted-diff: Use clang-tidy syntax for C++ named argumentsMarcoFalke
-BEGIN VERIFY SCRIPT- perl -0777 -pi -e 's:((\(|\{|,)(\n| )*)\/\* ?([^=* ]+) ?\*\/ ?:\1/*\4=*/:g' $( git ls-files ./src/test ./src/wallet/test ) -END VERIFY SCRIPT-
2021-07-16validation: add chainman ref to CChainStateJames O'Beirne
Add an upwards reference to chainstate instances to the owning ChainstateManager. This is necessary because there are a number of `this_chainstate == chainman.ActiveChainstate()` checks that will happen (as a result of assumeutxo) in functions that otherwise don't have an easily-accessible reference to the chainstate's ChainManager.
2021-07-13refactor: no mempool arg to GetCoinsCacheSizeStateJames O'Beirne
Unnecessary argument since we can make use of this->m_mempool Co-authored-by: John Newbery <john@johnnewbery.com>
2021-07-13validation: make CChainState::m_mempool optionalJames O'Beirne
Since we now have multiple chainstate objects, only one of them is active at any given time. An active chainstate has a mempool, but there's no point to others having one. This change will simplify proposed assumeutxo semantics. See the discussion here: https://github.com/bitcoin/bitcoin/pull/15606#pullrequestreview-692965905 Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2020-08-28Pass mempool reference to chainstate constructorMarcoFalke
2020-07-29Pass mempool pointer to GetCoinsCacheSizeStateMarcoFalke
2020-07-01Add CChainState::ResizeCoinsCachesJames O'Beirne
Also adds CCoinsViewCache::ReallocateCache() to attempt to free memory that the cacheCoins's allocator may be hanging onto when downsizing the cache. Adds `CChainState::m_coins{tip,db}_cache_size_bytes` data members so that we can reference cache size on a per-chainstate basis for flushing.
2020-05-08test: Fix outstanding -Wsign-compare errorsBen Woosley
2020-04-16scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-02-19test: Remove incorrect assumptions in validation_flush_testsMarcoFalke
2019-12-12tests: add tests for GetCoinsCacheSizeStateJames O'Beirne