Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix block index issue with wallet scan #1495

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,11 @@ CBlockIndex* CWallet::GetBlockByDate(CBlockIndex* pindexStart, const std::string

while (pindex) {
if (pindex->GetBlockTime() > targetTimestamp) {
return chainActive[pindex->nHeight - 200];
if (pindex->nHeight >= 200) {
return chainActive[pindex->nHeight - 200];
} else {
return chainActive[0];
}
}
pindex = chainActive.Next(pindex);
}
Expand Down Expand Up @@ -2411,7 +2415,6 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex *pindexStart, bool f
// If you are recovering wallet with mnemonics, start rescan from the block when mnemonics were implemented in Firo.
// If the user provides a date, start scanning from the block that corresponds to that date.
// If no date is provided, start scanning from the mnemonic start block.

std::string wcdate = GetArg("-wcdate", "");
CBlockIndex* mnemonicStartBlock = chainActive[chainParams.GetConsensus().nMnemonicBlock];
if (mnemonicStartBlock == NULL)
Expand Down
Loading