Merge #9827: Improve ScanForWalletTransactions return value
30abce7 Improve ScanForWalletTransactions return value (Russell Yanofsky) Tree-SHA512: 195028553b103052a842b6a37e67410118a20c32475b80f7fd22d6d8622f92eca1c2d84f291d1092bef2161d3187d91052799b533e1e265b7613d51955490b8d
This commit is contained in:
parent
383d1819a9
commit
a089c9325e
@ -426,6 +426,17 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
|
|||||||
BOOST_CHECK_EQUAL(response.write(), strprintf("[{\"success\":false,\"error\":{\"code\":-1,\"message\":\"Failed to rescan before time %d, transactions may be missing.\"}},{\"success\":true}]", newTip->GetBlockTimeMax()));
|
BOOST_CHECK_EQUAL(response.write(), strprintf("[{\"success\":false,\"error\":{\"code\":-1,\"message\":\"Failed to rescan before time %d, transactions may be missing.\"}},{\"success\":true}]", newTip->GetBlockTimeMax()));
|
||||||
::pwalletMain = backup;
|
::pwalletMain = backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify ScanForWalletTransactions does not return null when the scan is
|
||||||
|
// elided due to the nTimeFirstKey optimization.
|
||||||
|
{
|
||||||
|
CWallet wallet;
|
||||||
|
{
|
||||||
|
LOCK(wallet.cs_wallet);
|
||||||
|
wallet.UpdateTimeFirstKey(newTip->GetBlockTime() + 7200 + 1);
|
||||||
|
}
|
||||||
|
BOOST_CHECK_EQUAL(newTip, wallet.ScanForWalletTransactions(newTip));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify importwallet RPC starts rescan at earliest block with timestamp
|
// Verify importwallet RPC starts rescan at earliest block with timestamp
|
||||||
|
@ -1822,16 +1822,17 @@ void CWalletTx::GetAccountAmounts(const std::string& strAccount, CAmount& nRecei
|
|||||||
* exist in the wallet will be updated.
|
* exist in the wallet will be updated.
|
||||||
*
|
*
|
||||||
* Returns pointer to the first block in the last contiguous range that was
|
* Returns pointer to the first block in the last contiguous range that was
|
||||||
* successfully scanned.
|
* successfully scanned or elided (elided if pIndexStart points at a block
|
||||||
*
|
* before CWallet::nTimeFirstKey). Returns null if there is no such range, or
|
||||||
|
* the range doesn't include chainActive.Tip().
|
||||||
*/
|
*/
|
||||||
CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
||||||
{
|
{
|
||||||
CBlockIndex* ret = nullptr;
|
|
||||||
int64_t nNow = GetTime();
|
int64_t nNow = GetTime();
|
||||||
const CChainParams& chainParams = Params();
|
const CChainParams& chainParams = Params();
|
||||||
|
|
||||||
CBlockIndex* pindex = pindexStart;
|
CBlockIndex* pindex = pindexStart;
|
||||||
|
CBlockIndex* ret = pindexStart;
|
||||||
{
|
{
|
||||||
LOCK2(cs_main, cs_wallet);
|
LOCK2(cs_main, cs_wallet);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user