X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.h;h=39cd1ceae67e7fc09f84cd2f696c4ca7eed45512;hb=9d519fcff4e11f4e770c350fa69c302aed881b01;hp=ca43104782cbea5468256a62a8ab2ef95a67d9c0;hpb=879527c9516e78bb51f2efe2ab9758f38bd40dae;p=novacoin.git diff --git a/src/wallet.h b/src/wallet.h index ca43104..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 */ @@ -178,7 +192,7 @@ public: bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet); bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); - uint64 GetStakeMintPower(const CKeyStore& keystore); + 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); @@ -192,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();