X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fwallet.h;h=26cf745e3ca355868ca49dbcea3648cb08f39bc7;hp=de8da9747ebde0a23a2124269e1d245fbbad021f;hb=27e35b80c7f1b1bbf43f1d7b719a2569e8149f9f;hpb=3d5fa3073b359acdd8e4d7de46d24e2dcacf211f diff --git a/src/wallet.h b/src/wallet.h index de8da97..26cf745 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -85,6 +85,9 @@ private: // the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded int nWalletMaxVersion; + int64_t nNextResend; + int64_t nLastResend; + // stake mining statistics uint64_t nKernelsTried; uint64_t nCoinDaysTried; @@ -126,6 +129,8 @@ public: nMasterKeyMaxID = 0; pwalletdbEncryption = NULL; pwalletdbDecryption = NULL; + nNextResend = 0; + nLastResend = 0; nOrderPosNext = 0; nKernelsTried = 0; nCoinDaysTried = 0; @@ -219,7 +224,8 @@ public: int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false); int ScanForWalletTransaction(const uint256& hashTx); void ReacceptWalletTransactions(); - void ResendWalletTransactions(bool fForceResend=false); + void ResendWalletTransactions(int64_t nBestBlockTime); + std::vector ResendWalletTransactionsBefore(int64_t nTime); int64_t GetBalance() const; int64_t GetWatchOnlyBalance() const; int64_t GetUnconfirmedBalance() const; @@ -519,71 +525,14 @@ public: // marks certain txout's as spent // returns true if any update took place - bool UpdateSpent(const std::vector& vfNewSpent) - { - bool fReturn = false; - for (unsigned int i = 0; i < vfNewSpent.size(); i++) - { - if (i == vfSpent.size()) - break; - - if (vfNewSpent[i] && !vfSpent[i]) - { - vfSpent[i] = true; - fReturn = true; - fAvailableCreditCached = fAvailableWatchCreditCached = false; - } - } - return fReturn; - } + bool UpdateSpent(const std::vector& vfNewSpent); // make sure balances are recalculated - void MarkDirty() - { - fCreditCached = false; - fAvailableCreditCached = fAvailableWatchCreditCached = false; - fDebitCached = fWatchDebitCached = false; - fChangeCached = false; - } - - void BindWallet(CWallet *pwalletIn) - { - pwallet = pwalletIn; - MarkDirty(); - } - - void MarkSpent(unsigned int nOut) - { - if (nOut >= vout.size()) - throw std::runtime_error("CWalletTx::MarkSpent() : nOut out of range"); - vfSpent.resize(vout.size()); - if (!vfSpent[nOut]) - { - vfSpent[nOut] = true; - fAvailableCreditCached = fAvailableWatchCreditCached = false; - } - } - - void MarkUnspent(unsigned int nOut) - { - if (nOut >= vout.size()) - throw std::runtime_error("CWalletTx::MarkUnspent() : nOut out of range"); - vfSpent.resize(vout.size()); - if (vfSpent[nOut]) - { - vfSpent[nOut] = false; - fAvailableCreditCached = fAvailableWatchCreditCached = false; - } - } - - bool IsSpent(unsigned int nOut) const - { - if (nOut >= vout.size()) - throw std::runtime_error("CWalletTx::IsSpent() : nOut out of range"); - if (nOut >= vfSpent.size()) - return false; - return (!!vfSpent[nOut]); - } + void MarkDirty(); + void BindWallet(CWallet *pwalletIn); + void MarkSpent(unsigned int nOut); + void MarkUnspent(unsigned int nOut); + bool IsSpent(unsigned int nOut) const; int64_t GetDebit(const isminefilter& filter) const; int64_t GetCredit(const isminefilter& filter) const; @@ -617,8 +566,8 @@ public: bool AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs=true); bool AcceptWalletTransaction(); - void RelayWalletTransaction(CTxDB& txdb); - void RelayWalletTransaction(); + bool RelayWalletTransaction(CTxDB& txdb); + bool RelayWalletTransaction(); };