Skip to content

Commit d6f6a23

Browse files
committed
fixup! Return errors from importmulti if complete rescans are not successful
Skip empty loop if ReadBlockFromDisk fails as suggested #9773 (comment)
1 parent 34e4209 commit d6f6a23

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/wallet/wallet.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,15 +1574,15 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool f
15741574
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.TxData(), pindex) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
15751575

15761576
CBlock block;
1577-
if (!ReadBlockFromDisk(block, pindex, Params().GetConsensus())) {
1577+
if (ReadBlockFromDisk(block, pindex, Params().GetConsensus())) {
1578+
for (size_t posInBlock = 0; posInBlock < block.vtx.size(); ++posInBlock) {
1579+
AddToWalletIfInvolvingMe(*block.vtx[posInBlock], pindex, posInBlock, fUpdate);
1580+
}
1581+
if (!ret) {
1582+
ret = pindex;
1583+
}
1584+
} else {
15781585
ret = nullptr;
1579-
} else if (!ret) {
1580-
ret = pindex;
1581-
}
1582-
int posInBlock;
1583-
for (posInBlock = 0; posInBlock < (int)block.vtx.size(); posInBlock++)
1584-
{
1585-
AddToWalletIfInvolvingMe(*block.vtx[posInBlock], pindex, posInBlock, fUpdate);
15861586
}
15871587
pindex = chainActive.Next(pindex);
15881588
if (GetTime() >= nNow + 60) {

0 commit comments

Comments
 (0)