X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.h;h=39cd1ceae67e7fc09f84cd2f696c4ca7eed45512;hb=9d519fcff4e11f4e770c350fa69c302aed881b01;hp=7f848f689caf45ce5e9126a756e182288b1727b0;hpb=84a4a7763f386934da90e2bd1e355b70023fa9ca;p=novacoin.git diff --git a/src/wallet.h b/src/wallet.h index 7f848f6..39cd1ce 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -35,6 +35,13 @@ enum WalletFeature FEATURE_LATEST = 60000 }; +/** Stake weight calculation mode */ +enum StakeWeightMode +{ + STAKE_NORMAL = 0, // all 30+ days old inputs + STAKE_MAXWEIGHT = 1, // only 90+ days old inputs + STAKE_MINWEIGHT = 3 // only [30-90] days old inputs +}; /** A key pool entry */ class CKeyPool @@ -86,6 +93,7 @@ public: std::string strWalletFile; std::set setKeyPool; + std::map mapKeyMetadata; typedef std::map MasterKeyMap; @@ -119,6 +127,7 @@ public: std::map mapAddressBook; CPubKey vchDefaultKey; + int64 nTimeFirstKey; // check whether we are allowed to upgrade (or already support) to the named feature bool CanSupportFeature(enum WalletFeature wf) { return nWalletMaxVersion >= wf; } @@ -132,6 +141,8 @@ public: bool AddKey(const CKey& key); // Adds a key to the store, without saving it to disk (used by LoadWallet) bool LoadKey(const CKey& key) { return CCryptoKeyStore::AddKey(key); } + // Load metadata (used by LoadWallet) + bool LoadKeyMetadata(const CPubKey &pubkey, const CKeyMetadata &metadata); bool LoadMinVersion(int nVersion) { nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; } @@ -146,6 +157,9 @@ public: bool ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase); bool EncryptWallet(const SecureString& strWalletPassphrase); + void GetKeyBirthTimes(std::map &mapKeyBirth) const; + + /** Increment the next transaction order id @return next transaction order id */ @@ -177,7 +191,10 @@ public: bool CreateTransaction(const std::vector >& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet); bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet); bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); + + uint64 GetStakeWeight(const CKeyStore& keystore, enum StakeWeightMode mode=STAKE_NORMAL); bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64 nSearchInterval, CTransaction& txNew); + 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); @@ -189,7 +206,7 @@ public: void ReturnKey(int64 nIndex); bool GetKeyFromPool(CPubKey &key, bool fAllowReuse=true); int64 GetOldestKeyPoolTime(); - void GetAllReserveKeys(std::set& setAddress); + void GetAllReserveKeys(std::set& setAddress) const; std::set< std::set > GetAddressGroupings(); std::map GetAddressBalances();