mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 21:04:58 +02:00
Return errors from importmulti if complete rescans are not successful
This commit is contained in:
@@ -1545,10 +1545,14 @@ void CWalletTx::GetAccountAmounts(const string& strAccount, CAmount& nReceived,
|
||||
* Scan the block chain (starting in pindexStart) for transactions
|
||||
* from or to us. If fUpdate is true, found transactions that already
|
||||
* exist in the wallet will be updated.
|
||||
*
|
||||
* Returns pointer to the first block in the last contiguous range that was
|
||||
* successfully scanned.
|
||||
*
|
||||
*/
|
||||
int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
||||
CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
||||
{
|
||||
int ret = 0;
|
||||
CBlockIndex* ret = nullptr;
|
||||
int64_t nNow = GetTime();
|
||||
const CChainParams& chainParams = Params();
|
||||
|
||||
@@ -1570,12 +1574,15 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.TxData(), pindex) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
||||
|
||||
CBlock block;
|
||||
ReadBlockFromDisk(block, pindex, Params().GetConsensus());
|
||||
int posInBlock;
|
||||
for (posInBlock = 0; posInBlock < (int)block.vtx.size(); posInBlock++)
|
||||
{
|
||||
if (AddToWalletIfInvolvingMe(*block.vtx[posInBlock], pindex, posInBlock, fUpdate))
|
||||
ret++;
|
||||
if (ReadBlockFromDisk(block, pindex, Params().GetConsensus())) {
|
||||
for (size_t posInBlock = 0; posInBlock < block.vtx.size(); ++posInBlock) {
|
||||
AddToWalletIfInvolvingMe(*block.vtx[posInBlock], pindex, posInBlock, fUpdate);
|
||||
}
|
||||
if (!ret) {
|
||||
ret = pindex;
|
||||
}
|
||||
} else {
|
||||
ret = nullptr;
|
||||
}
|
||||
pindex = chainActive.Next(pindex);
|
||||
if (GetTime() >= nNow + 60) {
|
||||
|
||||
Reference in New Issue
Block a user