class COutput;
class CCoinControl;
+// Set of selected transactions
+typedef std::set<std::pair<const CWalletTx*,unsigned int> > CoinsSet;
+
+// Preloaded coins metadata
+// (txid, vout.n) => ((txindex, (tx, vout.n)), (block, modifier))
+typedef std::map<std::pair<uint256, unsigned int>, std::pair<std::pair<CTxIndex, std::pair<const CWalletTx*,unsigned int> >, std::pair<CBlock, uint64_t> > > MetaMap;
+
+
/** (client) version numbers for particular wallet features */
enum WalletFeature
{
bool SelectCoinsSimple(int64_t nTargetValue, int64_t nMinValue, int64_t nMaxValue, unsigned int nSpendTime, int nMinConf, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet) const;
bool SelectCoins(int64_t nTargetValue, unsigned int nSpendTime, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64_t& nValueRet, const CCoinControl *coinControl=NULL) const;
- CWalletDB *pwalletdbEncryption;
+ CWalletDB *pwalletdbEncryption, *pwalletdbDecryption;
// the current wallet version: clients below this version are not able to load the wallet
int nWalletVersion;
fFileBacked = false;
nMasterKeyMaxID = 0;
pwalletdbEncryption = NULL;
+ pwalletdbDecryption = NULL;
nOrderPosNext = 0;
nKernelsTried = 0;
nCoinDaysTried = 0;
fFileBacked = true;
nMasterKeyMaxID = 0;
pwalletdbEncryption = NULL;
+ pwalletdbDecryption = NULL;
nOrderPosNext = 0;
nKernelsTried = 0;
nCoinDaysTried = 0;
// Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)
bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { SetMinVersion(FEATURE_WALLETCRYPT); return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); }
bool AddCScript(const CScript& redeemScript);
- bool LoadCScript(const CScript& redeemScript) { return CCryptoKeyStore::AddCScript(redeemScript); }
+ bool LoadCScript(const CScript& redeemScript);
// Adds a watch-only address to the store, and saves it to disk.
bool AddWatchOnly(const CScript &dest);
bool Unlock(const SecureString& strWalletPassphrase);
bool ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);
bool EncryptWallet(const SecureString& strWalletPassphrase);
+ bool DecryptWallet(const SecureString& strWalletPassphrase);
void GetKeyBirthTimes(std::map<CKeyID, int64_t> &mapKeyBirth) const;
void GetStakeStats(float &nKernelsRate, float &nCoinDaysRate);
void GetStakeWeightFromValue(const int64_t& nTime, const int64_t& nValue, uint64_t& nWeight);
- bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64_t nSearchInterval, CTransaction& txNew, CKey& key);
+ bool CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, uint32_t nSearchInterval, CTransaction& txNew, CKey& key);
bool MergeCoins(const int64_t& nAmount, const int64_t& nMinValue, const int64_t& nMaxValue, std::list<uint256>& listMerged);
std::string SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false);
std::string SendMoneyToDestination(const CTxDestination &address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false);
- bool NewKeyPool();
+ bool NewKeyPool(unsigned int nSize = 0);
bool TopUpKeyPool(unsigned int nSize = 0);
int64_t AddReserveKey(const CKeyPool& keypool);
void ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool);
DBErrors LoadWallet(bool& fFirstRunRet);
+ DBErrors ZapWalletTx();
+
bool SetAddressBookName(const CTxDestination& address, const std::string& strName);
bool DelAddressBookName(const CTxDestination& address);
unsigned int GetKeyPoolSize()
{
- return setKeyPool.size();
+ return (unsigned int)(setKeyPool.size());
}
bool GetTransaction(const uint256 &hashTx, CWalletTx& wtx);