diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 29651adf9..e81eba03d 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -41,6 +41,7 @@ using namespace std; static uint64_t nAccountingEntryNumber = 0; static list deadTxns; +extern CBlockIndex *komodo_blockindex(uint256 hash); // // CWalletDB @@ -969,8 +970,8 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) fprintf(stderr, "Removing possible orphaned staking transaction from wallet.%s\n", hash.ToString().c_str()); if (!EraseTx(hash)) fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str()); - uint256 blockhash; CTransaction tx; - if ( GetTransaction(hash,tx,blockhash,false) && mapBlockIndex.find(blockhash) != mapBlockIndex.end() ) + uint256 blockhash; CTransaction tx; CBlockIndex* pindex; + if ( GetTransaction(hash,tx,blockhash,false) && (pindex= komodo_blockindex(blockhash)) != 0 && chainActive.Contains(pindex) ) { CWalletTx wtx(pwallet,tx); pwallet->AddToWallet(wtx, true, NULL);