aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2012-10-09 12:14:26 -0400
committerGavin Andresen <[email protected]>2012-10-09 12:14:26 -0400
commit673021410f48db3ad664d5c0dbf3a480ec0a0106 (patch)
treef722eb6bed24919b9170b7862dea27911fd5e137 /src/wallet.cpp
parentMerge branch 'crash_at_exit' of github.com:gavinandresen/bitcoin-git (diff)
parentDon't try to verify a non-existent wallet.dat (diff)
downloaddiscoin-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.cpp8
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"))