// Set of selected transactions
typedef std::set<std::pair<const CWalletTx*,unsigned int> > CoinsSet;
-/** (client) version numbers for particular wallet features */
+// (client) version numbers for particular wallet features
enum WalletFeature
{
FEATURE_BASE = 10500, // the earliest version new wallets supports (only useful for getinfo's clientversion output)
FEATURE_LATEST = 60017
};
-/** A key pool entry */
+// A key pool entry
class CKeyPool
{
public:
int64_t nTime;
CPubKey vchPubKey;
- CKeyPool()
- {
- nTime = GetTime();
- }
-
- CKeyPool(const CPubKey& vchPubKeyIn)
- {
- nTime = GetTime();
- vchPubKey = vchPubKeyIn;
- }
+ CKeyPool() : nTime(GetTime()) {}
+ CKeyPool(const CPubKey& vchPubKeyIn) : nTime(GetTime()), vchPubKey(vchPubKeyIn) {}
IMPLEMENT_SERIALIZE
(
)
};
-/** A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
- * and provides the ability to create new transactions.
- */
+// A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
+// and provides the ability to create new transactions.
+//
class CWallet : public CCryptoKeyStore
{
private:
bool LoadKey(const CMalleableKeyView &keyView, const CSecret &vchSecretH) { return CCryptoKeyStore::AddMalleableKey(keyView, vchSecretH); }
bool LoadCryptedKey(const CMalleableKeyView &keyView, const std::vector<unsigned char> &vchCryptedSecretH) { return CCryptoKeyStore::AddCryptedMalleableKey(keyView, vchCryptedSecretH); }
- bool LoadMinVersion(int nVersion) { nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; }
+ bool LoadMinVersion(int nVersion);
// Adds an encrypted key to the store, and saves it to disk.
bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
bool DelAddressBookName(const CBitcoinAddress& address);
void UpdatedTransaction(const uint256 &hashTx);
void PrintWallet(const CBlock& block);
-
- void Inventory(const uint256 &hash)
- {
- {
- LOCK(cs_wallet);
- auto mi = mapRequestCount.find(hash);
- if (mi != mapRequestCount.end())
- (*mi).second++;
- }
- }
+ void Inventory(const uint256 &hash);
unsigned int GetKeyPoolSize()
{
int64_t nIndex;
CPubKey vchPubKey;
public:
- CReserveKey(CWallet* pwalletIn)
- {
- nIndex = -1;
- pwallet = pwalletIn;
- }
+ CReserveKey(CWallet* pwalletIn) : pwallet(pwalletIn), nIndex(-1) {}
~CReserveKey()
{
typedef std::map<std::string, std::string> mapValue_t;
-
static void ReadOrderPos(int64_t& nOrderPos, mapValue_t& mapValue)
{
if (!mapValue.count("n"))
nOrderPos = strtoll(mapValue["n"]);
}
-
static void WriteOrderPos(const int64_t& nOrderPos, mapValue_t& mapValue)
{
if (nOrderPos == -1)
}
-/** A transaction with a bunch of additional info that only the owner cares about.
- * It includes any unrecorded transactions needed to link it back to the block chain.
- */
+// A transaction with a bunch of additional info that only the owner cares about.
+// It includes any unrecorded transactions needed to link it back to the block chain.
+//
class CWalletTx : public CMerkleTx
{
private:
int nDepth;
bool fSpendable;
- COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn)
- {
- tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn;
- }
+ COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn) :
+ tx(txIn), i(iIn), nDepth(nDepthIn), fSpendable(fSpendableIn) {}
std::string ToString() const
{
-/** Private key that includes an expiration date in case it never gets used. */
+// Private key that includes an expiration date in case it never gets used.
class CWalletKey
{
public:
//// todo: add something to note what created it (user, getnewaddress, change)
//// maybe should have a map<string, string> property map
- CWalletKey(int64_t nExpires=0)
- {
- nTimeCreated = (nExpires ? GetTime() : 0);
- nTimeExpires = nExpires;
- }
+ CWalletKey(int64_t nExpires=0) : nTimeCreated(nExpires ? GetTime() : 0), nTimeExpires(nExpires) {}
IMPLEMENT_SERIALIZE
(
-
-
/** Account information.
* Stored in wallet with key "acc"+string account name.
*/