diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8ecda92f1..7e77d2d24 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1753,8 +1753,6 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl AssertLockHeld(cs_wallet); if ( tx.IsCoinBase() && tx.vout[0].nValue == 0 ) return false; - if ( tx.vin.empty() ) - return false; bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto sproutNoteData = FindMySproutNotes(tx); diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index fc9f4b20f..21139e0c2 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -489,7 +489,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, fprintf(stderr, "Removing corrupt tx from wallet.%s\n", hash.ToString().c_str()); deadTxns.push_back(hash); return false; - } + } // Undo serialize changes in 31600 if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703) { @@ -953,11 +953,19 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) if (!deadTxns.empty()) { + int32_t reAdded = 0; BOOST_FOREACH (uint256& hash, deadTxns) { if (!EraseTx(hash)) fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str()); + uint256 blockhash; CTransaction tx; + if (GetTransaction(hash,tx,blockhash,true)) + { + CWalletTx wtx(pwallet,tx); + pwallet->AddToWallet(wtx, true, NULL); + reAdded++; + } } - fprintf(stderr, "Cleared %i corrupted transactions from wallet.\n",deadTxns.size()); + fprintf(stderr, "Cleared %lu corrupted transactions from wallet. Readded %i on chain transactions.\n",deadTxns.size(),reAdded); deadTxns.clear(); }