Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 790 Lines • ▼ Show 20 Lines | DBErrors CWallet::ReorderTransactions() { | ||||
} | } | ||||
nOrderPosNext = 0; | nOrderPosNext = 0; | ||||
std::vector<int64_t> nOrderPosOffsets; | std::vector<int64_t> nOrderPosOffsets; | ||||
for (TxItems::iterator it = txByTime.begin(); it != txByTime.end(); ++it) { | for (TxItems::iterator it = txByTime.begin(); it != txByTime.end(); ++it) { | ||||
CWalletTx *const pwtx = (*it).second.first; | CWalletTx *const pwtx = (*it).second.first; | ||||
CAccountingEntry *const pacentry = (*it).second.second; | CAccountingEntry *const pacentry = (*it).second.second; | ||||
int64_t &nOrderPos = | int64_t &nOrderPos = | ||||
(pwtx != 0) ? pwtx->nOrderPos : pacentry->nOrderPos; | (pwtx != nullptr) ? pwtx->nOrderPos : pacentry->nOrderPos; | ||||
if (nOrderPos == -1) { | if (nOrderPos == -1) { | ||||
nOrderPos = nOrderPosNext++; | nOrderPos = nOrderPosNext++; | ||||
nOrderPosOffsets.push_back(nOrderPos); | nOrderPosOffsets.push_back(nOrderPos); | ||||
if (pwtx) { | if (pwtx) { | ||||
if (!walletdb.WriteTx(*pwtx)) { | if (!walletdb.WriteTx(*pwtx)) { | ||||
return DB_LOAD_FAIL; | return DB_LOAD_FAIL; | ||||
▲ Show 20 Lines • Show All 1,062 Lines • ▼ Show 20 Lines | if (IsImmatureCoinBase() && IsInMainChain()) { | ||||
fImmatureCreditCached = true; | fImmatureCreditCached = true; | ||||
return nImmatureCreditCached; | return nImmatureCreditCached; | ||||
} | } | ||||
return Amount::zero(); | return Amount::zero(); | ||||
} | } | ||||
Amount CWalletTx::GetAvailableCredit(bool fUseCache) const { | Amount CWalletTx::GetAvailableCredit(bool fUseCache) const { | ||||
if (pwallet == 0) { | if (pwallet == nullptr) { | ||||
return Amount::zero(); | return Amount::zero(); | ||||
} | } | ||||
// Must wait until coinbase is safely deep enough in the chain before | // Must wait until coinbase is safely deep enough in the chain before | ||||
// valuing it. | // valuing it. | ||||
if (IsImmatureCoinBase()) { | if (IsImmatureCoinBase()) { | ||||
return Amount::zero(); | return Amount::zero(); | ||||
} | } | ||||
Show All 30 Lines | if (IsImmatureCoinBase() && IsInMainChain()) { | ||||
fImmatureWatchCreditCached = true; | fImmatureWatchCreditCached = true; | ||||
return nImmatureWatchCreditCached; | return nImmatureWatchCreditCached; | ||||
} | } | ||||
return Amount::zero(); | return Amount::zero(); | ||||
} | } | ||||
Amount CWalletTx::GetAvailableWatchOnlyCredit(const bool &fUseCache) const { | Amount CWalletTx::GetAvailableWatchOnlyCredit(const bool &fUseCache) const { | ||||
if (pwallet == 0) { | if (pwallet == nullptr) { | ||||
return Amount::zero(); | return Amount::zero(); | ||||
} | } | ||||
// Must wait until coinbase is safely deep enough in the chain before | // Must wait until coinbase is safely deep enough in the chain before | ||||
// valuing it. | // valuing it. | ||||
if (IsCoinBase() && GetBlocksToMaturity() > 0) { | if (IsCoinBase() && GetBlocksToMaturity() > 0) { | ||||
return Amount::zero(); | return Amount::zero(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,335 Lines • Show Last 20 Lines |