C++20 modernization: nullptr, constexpr, smart pointers, thread safety, enum class
- Replace ~320 NULL occurrences with nullptr across 47 files (-184 net lines) - static const -> constexpr for version, coin, utility constants - Collapse 9 PushMessage overloads into 1 variadic template with fold expressions - Convert boost::array -> std::array, boost::type_traits -> std:: equivalents - pwalletMain, pScriptCheckQueue, pScriptCheckThreads -> unique_ptr - mapOrphanBlocks values: raw CBlock* -> unique_ptr<CBlock> - Fix data races: add locks to wallet registration, pindexBest reads, mempool exists - pwalletdbEncryption: raw new/delete -> local unique_ptr, remove exit() calls - PoS reward overflow: CBigNum intermediate for nCoinAge * nRewardCoinYear - memset -> OPENSSL_cleanse for secure zeroing - Fix const-cast UB in SetMerkleBranch - Log silent catch(...) blocks instead of silently swallowing - Enum class: GetMinFeeMode, WalletFeature - std::string_view for 8 utility function parameters - Range-for with structured bindings: 63 iterator loops modernized - std::make_pair -> brace init: 35 sites - Delegating constructors: CWallet, CBlockIndex - Merkle tree caching, std::array for GetMedianTimePast - CScript copy ctor -> = default, operator!= -> = default
This commit is contained in:
@@ -44,7 +44,7 @@ bool DumpSnapshot(const fs::path& destPath,
|
||||
unsigned int nCollected = 0;
|
||||
while (pindex && nCollected < nHeaders) {
|
||||
CDiskBlockIndex diskindex(pindex);
|
||||
vHeaders.push_back(std::make_pair(*pindex->phashBlock, diskindex));
|
||||
vHeaders.push_back({*pindex->phashBlock, diskindex});
|
||||
pindex = pindex->pprev;
|
||||
nCollected++;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ bool DumpSnapshot(const fs::path& destPath,
|
||||
// documented on CTxDBIteratorBase guarantees a stable view of committed state.
|
||||
{
|
||||
CDataStream ssKeyPrefix(SER_DISK, CLIENT_VERSION);
|
||||
ssKeyPrefix << std::make_pair(std::string("u"), std::make_pair(uint256(0), (unsigned int)0));
|
||||
ssKeyPrefix << std::pair{std::string("u"), std::pair{uint256(0), (unsigned int)0}};
|
||||
std::string strPrefixBegin = ssKeyPrefix.str();
|
||||
|
||||
auto it = txdbRead.NewIterator();
|
||||
|
||||
Reference in New Issue
Block a user