This commit is contained in:
blackjok3r
2019-05-19 00:48:24 +08:00
parent d4aac39f75
commit e90ac44dde

View File

@@ -41,6 +41,7 @@ using namespace std;
static uint64_t nAccountingEntryNumber = 0; static uint64_t nAccountingEntryNumber = 0;
static list<uint256> deadTxns; static list<uint256> deadTxns;
extern CBlockIndex *komodo_blockindex(uint256 hash);
// //
// CWalletDB // 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()); fprintf(stderr, "Removing possible orphaned staking transaction from wallet.%s\n", hash.ToString().c_str());
if (!EraseTx(hash)) if (!EraseTx(hash))
fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str()); fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str());
uint256 blockhash; CTransaction tx; uint256 blockhash; CTransaction tx; CBlockIndex* pindex;
if ( GetTransaction(hash,tx,blockhash,false) && mapBlockIndex.find(blockhash) != mapBlockIndex.end() ) if ( GetTransaction(hash,tx,blockhash,false) && (pindex= komodo_blockindex(blockhash)) != 0 && chainActive.Contains(pindex) )
{ {
CWalletTx wtx(pwallet,tx); CWalletTx wtx(pwallet,tx);
pwallet->AddToWallet(wtx, true, NULL); pwallet->AddToWallet(wtx, true, NULL);