mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
wallet: Move nAccountingEntryNumber from static/global to CWallet
This commit is contained in:
parent
9d15d5548d
commit
23fb9adaea
@ -2871,7 +2871,7 @@ bool CWallet::AddAccountingEntry(const CAccountingEntry& acentry)
|
|||||||
|
|
||||||
bool CWallet::AddAccountingEntry(const CAccountingEntry& acentry, CWalletDB *pwalletdb)
|
bool CWallet::AddAccountingEntry(const CAccountingEntry& acentry, CWalletDB *pwalletdb)
|
||||||
{
|
{
|
||||||
if (!pwalletdb->WriteAccountingEntry_Backend(acentry))
|
if (!pwalletdb->WriteAccountingEntry(++nAccountingEntryNumber, acentry))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
laccentries.push_back(acentry);
|
laccentries.push_back(acentry);
|
||||||
|
@ -785,6 +785,7 @@ public:
|
|||||||
nMasterKeyMaxID = 0;
|
nMasterKeyMaxID = 0;
|
||||||
pwalletdbEncryption = NULL;
|
pwalletdbEncryption = NULL;
|
||||||
nOrderPosNext = 0;
|
nOrderPosNext = 0;
|
||||||
|
nAccountingEntryNumber = 0;
|
||||||
nNextResend = 0;
|
nNextResend = 0;
|
||||||
nLastResend = 0;
|
nLastResend = 0;
|
||||||
nTimeFirstKey = 0;
|
nTimeFirstKey = 0;
|
||||||
@ -802,6 +803,7 @@ public:
|
|||||||
TxItems wtxOrdered;
|
TxItems wtxOrdered;
|
||||||
|
|
||||||
int64_t nOrderPosNext;
|
int64_t nOrderPosNext;
|
||||||
|
uint64_t nAccountingEntryNumber;
|
||||||
std::map<uint256, int> mapRequestCount;
|
std::map<uint256, int> mapRequestCount;
|
||||||
|
|
||||||
std::map<CTxDestination, CAddressBookData> mapAddressBook;
|
std::map<CTxDestination, CAddressBookData> mapAddressBook;
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
static uint64_t nAccountingEntryNumber = 0;
|
|
||||||
|
|
||||||
static std::atomic<unsigned int> nWalletDBUpdateCounter;
|
static std::atomic<unsigned int> nWalletDBUpdateCounter;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -180,11 +178,6 @@ bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccount
|
|||||||
return WriteIC(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry);
|
return WriteIC(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWalletDB::WriteAccountingEntry_Backend(const CAccountingEntry& acentry)
|
|
||||||
{
|
|
||||||
return WriteAccountingEntry(++nAccountingEntryNumber, acentry);
|
|
||||||
}
|
|
||||||
|
|
||||||
CAmount CWalletDB::GetAccountCreditDebit(const std::string& strAccount)
|
CAmount CWalletDB::GetAccountCreditDebit(const std::string& strAccount)
|
||||||
{
|
{
|
||||||
std::list<CAccountingEntry> entries;
|
std::list<CAccountingEntry> entries;
|
||||||
@ -321,8 +314,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||||||
ssKey >> strAccount;
|
ssKey >> strAccount;
|
||||||
uint64_t nNumber;
|
uint64_t nNumber;
|
||||||
ssKey >> nNumber;
|
ssKey >> nNumber;
|
||||||
if (nNumber > nAccountingEntryNumber)
|
if (nNumber > pwallet->nAccountingEntryNumber) {
|
||||||
nAccountingEntryNumber = nNumber;
|
pwallet->nAccountingEntryNumber = nNumber;
|
||||||
|
}
|
||||||
|
|
||||||
if (!wss.fAnyUnordered)
|
if (!wss.fAnyUnordered)
|
||||||
{
|
{
|
||||||
|
@ -201,7 +201,6 @@ public:
|
|||||||
/// This writes directly to the database, and will not update the CWallet's cached accounting entries!
|
/// This writes directly to the database, and will not update the CWallet's cached accounting entries!
|
||||||
/// Use wallet.AddAccountingEntry instead, to write *and* update its caches.
|
/// Use wallet.AddAccountingEntry instead, to write *and* update its caches.
|
||||||
bool WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry);
|
bool WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry);
|
||||||
bool WriteAccountingEntry_Backend(const CAccountingEntry& acentry);
|
|
||||||
bool ReadAccount(const std::string& strAccount, CAccount& account);
|
bool ReadAccount(const std::string& strAccount, CAccount& account);
|
||||||
bool WriteAccount(const std::string& strAccount, const CAccount& account);
|
bool WriteAccount(const std::string& strAccount, const CAccount& account);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user