diff options
| author | Gavin Andresen <[email protected]> | 2012-10-09 12:14:26 -0400 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2012-10-09 12:14:26 -0400 |
| commit | 673021410f48db3ad664d5c0dbf3a480ec0a0106 (patch) | |
| tree | f722eb6bed24919b9170b7862dea27911fd5e137 /src/wallet.cpp | |
| parent | Merge branch 'crash_at_exit' of github.com:gavinandresen/bitcoin-git (diff) | |
| parent | Don't try to verify a non-existent wallet.dat (diff) | |
| download | discoin-673021410f48db3ad664d5c0dbf3a480ec0a0106.tar.xz discoin-673021410f48db3ad664d5c0dbf3a480ec0a0106.zip | |
Merge branch 'wallet_exceptions' of github.com:gavinandresen/bitcoin-git
Diffstat (limited to 'src/wallet.cpp')
| -rw-r--r-- | src/wallet.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index f3e71f59a..1a6a1082b 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -335,7 +335,9 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx) if (mi != mapWallet.end()) { CWalletTx& wtx = (*mi).second; - if (!wtx.IsSpent(txin.prevout.n) && IsMine(wtx.vout[txin.prevout.n])) + if (txin.prevout.n >= wtx.vout.size()) + printf("WalletUpdateSpent: bad wtx %s\n", wtx.GetHash().ToString().c_str()); + else if (!wtx.IsSpent(txin.prevout.n) && IsMine(wtx.vout[txin.prevout.n])) { printf("WalletUpdateSpent found spent coin %sbc %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str()); wtx.MarkSpent(txin.prevout.n); @@ -1371,12 +1373,12 @@ string CWallet::SendMoneyToDestination(const CTxDestination& address, int64 nVal -int CWallet::LoadWallet(bool& fFirstRunRet) +DBErrors CWallet::LoadWallet(bool& fFirstRunRet) { if (!fFileBacked) return DB_LOAD_OK; fFirstRunRet = false; - int nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this); + DBErrors nLoadWalletRet = CWalletDB(strWalletFile,"cr+").LoadWallet(this); if (nLoadWalletRet == DB_NEED_REWRITE) { if (CDB::Rewrite(strWalletFile, "\x04pool")) |