Changeset View
Changeset View
Standalone View
Standalone View
src/test/validation_chainstate_tests.cpp
Show All 28 Lines | auto add_coin = [](CCoinsViewCache &coins_view) -> COutPoint { | ||||
CScript scriptPubKey; | CScript scriptPubKey; | ||||
scriptPubKey.assign((uint32_t)56, 1); | scriptPubKey.assign((uint32_t)56, 1); | ||||
Coin newcoin(CTxOut(nValue, std::move(scriptPubKey)), 1, false); | Coin newcoin(CTxOut(nValue, std::move(scriptPubKey)), 1, false); | ||||
coins_view.AddCoin(outp, std::move(newcoin), false); | coins_view.AddCoin(outp, std::move(newcoin), false); | ||||
return outp; | return outp; | ||||
}; | }; | ||||
ENTER_CRITICAL_SECTION(cs_main); | CChainState &c1 = | ||||
CChainState &c1 = manager.InitializeChainstate(); | *WITH_LOCK(cs_main, return &manager.InitializeChainstate()); | ||||
LEAVE_CRITICAL_SECTION(cs_main); | |||||
c1.InitCoinsDB( | c1.InitCoinsDB( | ||||
/* cache_size_bytes */ 1 << 23, /* in_memory */ true, | /* cache_size_bytes */ 1 << 23, /* in_memory */ true, | ||||
/* should_wipe */ false); | /* should_wipe */ false); | ||||
WITH_LOCK(::cs_main, c1.InitCoinsCache(1 << 23)); | WITH_LOCK(::cs_main, c1.InitCoinsCache(1 << 23)); | ||||
// Add a coin to the in-memory cache, upsize once, then downsize. | // Add a coin to the in-memory cache, upsize once, then downsize. | ||||
{ | { | ||||
LOCK(::cs_main); | LOCK(::cs_main); | ||||
Show All 28 Lines |