Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_tests.cpp
Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | |||||
static int64_t AddTx(CWallet &wallet, uint32_t lockTime, int64_t mockTime, | static int64_t AddTx(CWallet &wallet, uint32_t lockTime, int64_t mockTime, | ||||
int64_t blockTime) { | int64_t blockTime) { | ||||
CMutableTransaction tx; | CMutableTransaction tx; | ||||
tx.nLockTime = lockTime; | tx.nLockTime = lockTime; | ||||
SetMockTime(mockTime); | SetMockTime(mockTime); | ||||
CBlockIndex *block = nullptr; | CBlockIndex *block = nullptr; | ||||
if (blockTime > 0) { | if (blockTime > 0) { | ||||
LockAnnotation lock(::cs_main); | |||||
auto locked_chain = wallet.chain().lock(); | auto locked_chain = wallet.chain().lock(); | ||||
LockAnnotation lock(::cs_main); | |||||
auto inserted = | auto inserted = | ||||
mapBlockIndex.emplace(BlockHash(GetRandHash()), new CBlockIndex); | mapBlockIndex.emplace(BlockHash(GetRandHash()), new CBlockIndex); | ||||
assert(inserted.second); | assert(inserted.second); | ||||
const BlockHash &hash = inserted.first->first; | const BlockHash &hash = inserted.first->first; | ||||
block = inserted.first->second; | block = inserted.first->second; | ||||
block->nTime = blockTime; | block->nTime = blockTime; | ||||
block->phashBlock = &hash; | block->phashBlock = &hash; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |