Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_tests.cpp
Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | static int64_t AddTx(CWallet &wallet, uint32_t lockTime, int64_t mockTime, | ||||
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) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
auto inserted = mapBlockIndex.emplace(GetRandHash(), new CBlockIndex); | auto inserted = mapBlockIndex.emplace(GetRandHash(), new CBlockIndex); | ||||
assert(inserted.second); | assert(inserted.second); | ||||
const uint256 &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; | ||||
} | } | ||||
CWalletTx wtx(&wallet, MakeTransactionRef(tx)); | CWalletTx wtx(&wallet, MakeTransactionRef(tx)); | ||||
if (block) { | if (block) { | ||||
wtx.SetMerkleBranch(block, 0); | wtx.SetMerkleBranch(block, 0); | ||||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |