|
|
|
@ -739,13 +739,13 @@ DBErrors CWallet::ReorderTransactions()
|
|
|
|
|
for (std::map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
CWalletTx* wtx = &((*it).second);
|
|
|
|
|
txByTime.insert(std::make_pair(wtx->nTimeReceived, TxPair(wtx, (CAccountingEntry*)0)));
|
|
|
|
|
txByTime.insert(std::make_pair(wtx->nTimeReceived, TxPair(wtx, nullptr)));
|
|
|
|
|
}
|
|
|
|
|
std::list<CAccountingEntry> acentries;
|
|
|
|
|
walletdb.ListAccountCreditDebit("", acentries);
|
|
|
|
|
for (CAccountingEntry& entry : acentries)
|
|
|
|
|
{
|
|
|
|
|
txByTime.insert(std::make_pair(entry.nTime, TxPair((CWalletTx*)0, &entry)));
|
|
|
|
|
txByTime.insert(std::make_pair(entry.nTime, TxPair(nullptr, &entry)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nOrderPosNext = 0;
|
|
|
|
@ -754,7 +754,7 @@ DBErrors CWallet::ReorderTransactions()
|
|
|
|
|
{
|
|
|
|
|
CWalletTx *const pwtx = (*it).second.first;
|
|
|
|
|
CAccountingEntry *const pacentry = (*it).second.second;
|
|
|
|
|
int64_t& nOrderPos = (pwtx != 0) ? pwtx->nOrderPos : pacentry->nOrderPos;
|
|
|
|
|
int64_t& nOrderPos = (pwtx != nullptr) ? pwtx->nOrderPos : pacentry->nOrderPos;
|
|
|
|
|
|
|
|
|
|
if (nOrderPos == -1)
|
|
|
|
|
{
|
|
|
|
@ -939,7 +939,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
|
|
|
|
|
{
|
|
|
|
|
wtx.nTimeReceived = GetAdjustedTime();
|
|
|
|
|
wtx.nOrderPos = IncOrderPosNext(&walletdb);
|
|
|
|
|
wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, (CAccountingEntry*)0)));
|
|
|
|
|
wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr)));
|
|
|
|
|
wtx.nTimeSmart = ComputeTimeSmart(wtx);
|
|
|
|
|
AddToSpends(hash);
|
|
|
|
|
}
|
|
|
|
@ -1004,7 +1004,7 @@ bool CWallet::LoadToWallet(const CWalletTx& wtxIn)
|
|
|
|
|
mapWallet[hash] = wtxIn;
|
|
|
|
|
CWalletTx& wtx = mapWallet[hash];
|
|
|
|
|
wtx.BindWallet(this);
|
|
|
|
|
wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, (CAccountingEntry*)0)));
|
|
|
|
|
wtxOrdered.insert(std::make_pair(wtx.nOrderPos, TxPair(&wtx, nullptr)));
|
|
|
|
|
AddToSpends(hash);
|
|
|
|
|
for (const CTxIn& txin : wtx.tx->vin) {
|
|
|
|
|
if (mapWallet.count(txin.prevout.hash)) {
|
|
|
|
@ -1794,7 +1794,7 @@ CAmount CWalletTx::GetImmatureCredit(bool fUseCache) const
|
|
|
|
|
|
|
|
|
|
CAmount CWalletTx::GetAvailableCredit(bool fUseCache) const
|
|
|
|
|
{
|
|
|
|
|
if (pwallet == 0)
|
|
|
|
|
if (pwallet == nullptr)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
// Must wait until coinbase is safely deep enough in the chain before valuing it
|
|
|
|
@ -1838,7 +1838,7 @@ CAmount CWalletTx::GetImmatureWatchOnlyCredit(const bool& fUseCache) const
|
|
|
|
|
|
|
|
|
|
CAmount CWalletTx::GetAvailableWatchOnlyCredit(const bool& fUseCache) const
|
|
|
|
|
{
|
|
|
|
|
if (pwallet == 0)
|
|
|
|
|
if (pwallet == nullptr)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
// Must wait until coinbase is safely deep enough in the chain before valuing it
|
|
|
|
@ -3026,7 +3026,7 @@ bool CWallet::AddAccountingEntry(const CAccountingEntry& acentry, CWalletDB *pwa
|
|
|
|
|
|
|
|
|
|
laccentries.push_back(acentry);
|
|
|
|
|
CAccountingEntry & entry = laccentries.back();
|
|
|
|
|
wtxOrdered.insert(std::make_pair(entry.nOrderPos, TxPair((CWalletTx*)0, &entry)));
|
|
|
|
|
wtxOrdered.insert(std::make_pair(entry.nOrderPos, TxPair(nullptr, &entry)));
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|