X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.h;h=c1b8f1a66ad3ab208f6ee6f0484154d7a287d4b7;hb=a51b421f76da8bfb88dedd159789eec0063d3087;hp=3d07f5738f887b7595cc41fde6a568773d95f998;hpb=4ffa25aa74b459ff189a74b8cb40f1c07e34e36c;p=novacoin.git diff --git a/src/wallet.h b/src/wallet.h index 3d07f57..c1b8f1a 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -69,7 +69,7 @@ public: class CWallet : public CCryptoKeyStore { private: - bool SelectCoinsSimple(int64 nTargetValue, unsigned int nSpendTime, int nMinConf, std::set >& setCoinsRet, int64& nValueRet) const; + bool SelectCoinsSimple(int64 nTargetValue, int64 nMinValue, int64 nMaxValue, unsigned int nSpendTime, int nMinConf, std::set >& setCoinsRet, int64& nValueRet) const; bool SelectCoins(int64 nTargetValue, unsigned int nSpendTime, std::set >& setCoinsRet, int64& nValueRet, const CCoinControl *coinControl=NULL) const; CWalletDB *pwalletdbEncryption; @@ -80,6 +80,9 @@ private: // the maximum wallet format version: memory-only variable that specifies to what version this wallet may be upgraded int nWalletMaxVersion; + // selected coins metadata + std::map, std::pair >, std::pair > > mapMeta; + public: mutable CCriticalSection cs_wallet; @@ -115,6 +118,7 @@ public: } std::map mapWallet; + std::vector vMintingWalletUpdated; int64 nOrderPosNext; std::map mapRequestCount; @@ -126,7 +130,7 @@ public: // check whether we are allowed to upgrade (or already support) to the named feature bool CanSupportFeature(enum WalletFeature wf) { return nWalletMaxVersion >= wf; } - void AvailableCoinsMinConf(std::vector& vCoins, int nConf) const; + void AvailableCoinsMinConf(std::vector& vCoins, int nConf, int64 nMinValue, int64 nMaxValue) const; void AvailableCoins(std::vector& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl=NULL) const; bool SelectCoinsMinConf(int64 nTargetValue, unsigned int nSpendTime, int nConfMine, int nConfTheirs, std::vector vCoins, std::set >& setCoinsRet, int64& nValueRet) const; // keystore implementation @@ -178,6 +182,7 @@ public: bool AddToWallet(const CWalletTx& wtxIn); bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate = false, bool fFindBlock = false); bool EraseFromWallet(uint256 hash); + void ClearOrphans(); void WalletUpdateSpent(const CTransaction& prevout, bool fBlock = false); int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false); int ScanForWalletTransaction(const uint256& hashTx); @@ -200,6 +205,7 @@ public: bool GetStakeWeight(const CKeyStore& keystore, uint64& nMinWeight, uint64& nMaxWeight, uint64& nWeight); void GetStakeWeightFromValue(const int64& nTime, const int64& nValue, uint64& nWeight); bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64 nSearchInterval, CTransaction& txNew, CKey& key); + bool MergeCoins(const int64& nAmount, const int64& nMinValue, const int64& nMaxValue, std::list& listMerged); std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); @@ -460,6 +466,8 @@ public: fWatchCreditCached = false; fAvailableCreditCached = false; fAvailableWatchCreditCached = false; + fImmatureCreditCached = false; + fImmatureWatchCreditCached = false; fChangeCached = false; nDebitCached = 0; nWatchDebitCached = 0; @@ -467,6 +475,8 @@ public: nWatchCreditCached = 0; nAvailableCreditCached = 0; nAvailableWatchCreditCached = 0; + nImmatureCreditCached = 0; + nImmatureWatchCreditCached = 0; nChangeCached = 0; nOrderPos = -1; } @@ -648,7 +658,7 @@ public: int64 GetImmatureCredit(bool fUseCache=true) const { - if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0 && IsInMainChain()) + if (IsCoinBase() && GetBlocksToMaturity() > 0 && IsInMainChain()) { if (fUseCache && fImmatureCreditCached) return nImmatureCreditCached; @@ -662,7 +672,7 @@ public: int64 GetImmatureWatchOnlyCredit(bool fUseCache=true) const { - if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0 && IsInMainChain()) + if (IsCoinBase() && GetBlocksToMaturity() > 0 && IsInMainChain()) { if (fUseCache && fImmatureWatchCreditCached) return nImmatureWatchCreditCached;