Add support for watch-only addresses
Changes: * Add Add/Have WatchOnly methods to CKeyStore, and implementations in CBasicKeyStore. * Add similar methods to CWallet, and support entries for it in CWalletDB. * Make IsMine in script/wallet return a new enum 'isminetype', rather than a boolean. This allows distinguishing between spendable and unspendable coins. * Add a field fSpendable to COutput (GetAvailableCoins' return type). * Mark watchonly coins in listunspent as 'watchonly': true. * Add 'watchonly' to validateaddress, suppressing script/pubkey/... in this case. Based on a patch by Eric Lombrozo. Conflicts: src/qt/walletmodel.cpp src/rpcserver.cpp src/wallet.cpp
This commit is contained in:
14
src/wallet.h
14
src/wallet.h
@@ -226,6 +226,11 @@ public:
|
||||
/// Look up a destination data tuple in the store, return true if found false otherwise
|
||||
bool GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const;
|
||||
|
||||
// Adds a watch-only address to the store, and saves it to disk.
|
||||
bool AddWatchOnly(const CTxDestination &dest);
|
||||
// Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
|
||||
bool LoadWatchOnly(const CTxDestination &dest);
|
||||
|
||||
bool Unlock(const SecureString& strWalletPassphrase);
|
||||
bool ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);
|
||||
bool EncryptWallet(const SecureString& strWalletPassphrase);
|
||||
@@ -279,9 +284,9 @@ public:
|
||||
|
||||
std::set<CTxDestination> GetAccountAddresses(std::string strAccount) const;
|
||||
|
||||
bool IsMine(const CTxIn& txin) const;
|
||||
isminetype IsMine(const CTxIn& txin) const;
|
||||
int64_t GetDebit(const CTxIn& txin) const;
|
||||
bool IsMine(const CTxOut& txout) const
|
||||
isminetype IsMine(const CTxOut& txout) const
|
||||
{
|
||||
return ::IsMine(*this, txout.scriptPubKey);
|
||||
}
|
||||
@@ -722,10 +727,11 @@ public:
|
||||
const CWalletTx *tx;
|
||||
int i;
|
||||
int nDepth;
|
||||
bool fSpendable;
|
||||
|
||||
COutput(const CWalletTx *txIn, int iIn, int nDepthIn)
|
||||
COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn)
|
||||
{
|
||||
tx = txIn; i = iIn; nDepth = nDepthIn;
|
||||
tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn;
|
||||
}
|
||||
|
||||
std::string ToString() const
|
||||
|
||||
Reference in New Issue
Block a user