aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletdb.cpp
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2016-05-09 00:15:12 -0700
committerPatrick Strateman <patrick.strateman@gmail.com>2016-05-09 00:20:17 -0700
commit0fd599767d2dabf25ac8c3543cb586cfc4b9d816 (patch)
tree13c6a9ce0048dd662d98136caf0774a81619859e /src/wallet/walletdb.cpp
parentfbd84788e676c9cbd126f6236ec46bb2f342bd00 (diff)
downloadbitcoin-0fd599767d2dabf25ac8c3543cb586cfc4b9d816.tar.xz
Fix insanity of CWalletDB::WriteTx and CWalletTx::WriteToDisk
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r--src/wallet/walletdb.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index f2b5408e92..48579b2821 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -55,10 +55,10 @@ bool CWalletDB::ErasePurpose(const string& strPurpose)
return Erase(make_pair(string("purpose"), strPurpose));
}
-bool CWalletDB::WriteTx(uint256 hash, const CWalletTx& wtx)
+bool CWalletDB::WriteTx(const CWalletTx& wtx)
{
nWalletDBUpdated++;
- return Write(std::make_pair(std::string("tx"), hash), wtx);
+ return Write(std::make_pair(std::string("tx"), wtx.GetHash()), wtx);
}
bool CWalletDB::EraseTx(uint256 hash)
@@ -291,7 +291,7 @@ DBErrors CWalletDB::ReorderTransactions(CWallet* pwallet)
if (pwtx)
{
- if (!WriteTx(pwtx->GetHash(), *pwtx))
+ if (!WriteTx(*pwtx))
return DB_LOAD_FAIL;
}
else
@@ -315,7 +315,7 @@ DBErrors CWalletDB::ReorderTransactions(CWallet* pwallet)
// Since we're changing the order, write it back
if (pwtx)
{
- if (!WriteTx(pwtx->GetHash(), *pwtx))
+ if (!WriteTx(*pwtx))
return DB_LOAD_FAIL;
}
else
@@ -698,7 +698,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
pwallet->nTimeFirstKey = 1; // 0 would be considered 'no value'
BOOST_FOREACH(uint256 hash, wss.vWalletUpgrade)
- WriteTx(hash, pwallet->mapWallet[hash]);
+ WriteTx(pwallet->mapWallet[hash]);
// Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc:
if (wss.fIsEncrypted && (wss.nFileVersion == 40000 || wss.nFileVersion == 50000))