James O'Beirne
617661703a
validation: make CChainState::m_mempool optional
...
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>
2021-07-13 11:11:35 -04:00
Carl Dong
3eb94ec81b
sync: Use decltype(auto) return type for WITH_LOCK
...
Now that we're using C++17, we can use the decltype(auto) return type
(available since C++14) for functions and lambda expressions.
As demonstrated in this commit, this can simplify cases where previously
the compiler failed to deduce the correct return type.
Just for reference, for the "assign to ref" cases fixed here, there are
3 possible solutions:
- Return a pointer and immediately deref as used before this commit
- Make sure the function/lambda returns declspec(auto) as used after
this commit
- Class& i = WITH_LOCK(..., return std::ref(...));
-----
References:
1. https://en.cppreference.com/w/cpp/language/function#Return_type_deduction
2. https://en.cppreference.com/w/cpp/language/template_argument_deduction#Other_contexts
3. https://en.cppreference.com/w/cpp/language/auto
4. https://en.cppreference.com/w/cpp/language/decltype
Explanations:
1. https://stackoverflow.com/a/21369192
2. https://stackoverflow.com/a/21369170
3. Item 3 in Effective Modern C++ (Scott Meyers) via jnewbery
2020-12-04 12:23:05 -05:00
MarcoFalke
fa0572d0f3
Pass mempool reference to chainstate constructor
2020-08-28 10:42:04 +02:00
MarcoFalke
faec851b6e
test: Simplify cs_main locks
2020-07-29 08:00:54 +02:00
James O'Beirne
f19fdd47a6
test: add test for CChainState::ResizeCoinsCaches()
2020-07-01 14:44:28 -04:00