mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge pull request #4045
a3e192areplaced MINE_ with ISMINE_ (JaSK)53a2148fixed bug where validateaddress doesn't display information (JaSK)f28707afixed bug in ListReceived() (JaSK)519dd1cAdded MINE_ALL = (spendable|watchonly) (JaSK)23b0506Fixed some stuff in TransactionDesc (JaSK)80dda36removed default argument values for ismine filter (JaSK)d5087d1Use script matching rather than destination matching for watch-only. (Pieter Wuille)0fa2f88added includedWatchonly argument to listreceivedbyaddress/...account (JaSK)f87ba3dadded includeWatchonly argument to 'gettransaction' because it affects balance calculation (JaSK)a5c6c5dfixed tiny glitch and improved readability like laanwj suggested (JaSK)d7d5d23Added argument to listtransactions and listsinceblock to include watchonly addresses (JaSK)952877eShowing 'involvesWatchonly' property for transactions returned by 'listtransactions' and 'listsinceblock'. It is only appended when the transaction involves a watchonly address. (JaSK)83f3543Added argument to listaccounts to include watchonly addresses (JaSK)d4640d7Added argument to getbalance to include watchonly addresses and fixed errors in balance calculation. (JaSK)d2692f6Watchonly transactions are marked in transaction history (JaSK)ffd40daWatchonly balances are shown separately in gui. (JaSK)2935b21qt: Hide unspendable outputs in coin control (Wladimir J. van der Laan)c898846Add support for watch-only addresses (Pieter Wuille)
This commit is contained in:
@@ -92,36 +92,45 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
#ifdef ENABLE_WALLET
|
||||
class DescribeAddressVisitor : public boost::static_visitor<Object>
|
||||
{
|
||||
private:
|
||||
isminetype mine;
|
||||
|
||||
public:
|
||||
DescribeAddressVisitor(isminetype mineIn) : mine(mineIn) {}
|
||||
|
||||
Object operator()(const CNoDestination &dest) const { return Object(); }
|
||||
|
||||
Object operator()(const CKeyID &keyID) const {
|
||||
Object obj;
|
||||
CPubKey vchPubKey;
|
||||
pwalletMain->GetPubKey(keyID, vchPubKey);
|
||||
obj.push_back(Pair("isscript", false));
|
||||
obj.push_back(Pair("pubkey", HexStr(vchPubKey)));
|
||||
obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed()));
|
||||
if (mine == ISMINE_SPENDABLE) {
|
||||
pwalletMain->GetPubKey(keyID, vchPubKey);
|
||||
obj.push_back(Pair("pubkey", HexStr(vchPubKey)));
|
||||
obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed()));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
Object operator()(const CScriptID &scriptID) const {
|
||||
Object obj;
|
||||
obj.push_back(Pair("isscript", true));
|
||||
CScript subscript;
|
||||
pwalletMain->GetCScript(scriptID, subscript);
|
||||
std::vector<CTxDestination> addresses;
|
||||
txnouttype whichType;
|
||||
int nRequired;
|
||||
ExtractDestinations(subscript, whichType, addresses, nRequired);
|
||||
obj.push_back(Pair("script", GetTxnOutputType(whichType)));
|
||||
obj.push_back(Pair("hex", HexStr(subscript.begin(), subscript.end())));
|
||||
Array a;
|
||||
BOOST_FOREACH(const CTxDestination& addr, addresses)
|
||||
a.push_back(CBitcoinAddress(addr).ToString());
|
||||
obj.push_back(Pair("addresses", a));
|
||||
if (whichType == TX_MULTISIG)
|
||||
obj.push_back(Pair("sigsrequired", nRequired));
|
||||
if (mine != ISMINE_NO) {
|
||||
CScript subscript;
|
||||
pwalletMain->GetCScript(scriptID, subscript);
|
||||
std::vector<CTxDestination> addresses;
|
||||
txnouttype whichType;
|
||||
int nRequired;
|
||||
ExtractDestinations(subscript, whichType, addresses, nRequired);
|
||||
obj.push_back(Pair("script", GetTxnOutputType(whichType)));
|
||||
obj.push_back(Pair("hex", HexStr(subscript.begin(), subscript.end())));
|
||||
Array a;
|
||||
BOOST_FOREACH(const CTxDestination& addr, addresses)
|
||||
a.push_back(CBitcoinAddress(addr).ToString());
|
||||
obj.push_back(Pair("addresses", a));
|
||||
if (whichType == TX_MULTISIG)
|
||||
obj.push_back(Pair("sigsrequired", nRequired));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
@@ -161,10 +170,11 @@ Value validateaddress(const Array& params, bool fHelp)
|
||||
string currentAddress = address.ToString();
|
||||
ret.push_back(Pair("address", currentAddress));
|
||||
#ifdef ENABLE_WALLET
|
||||
bool fMine = pwalletMain ? IsMine(*pwalletMain, dest) : false;
|
||||
ret.push_back(Pair("ismine", fMine));
|
||||
if (fMine) {
|
||||
Object detail = boost::apply_visitor(DescribeAddressVisitor(), dest);
|
||||
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
|
||||
ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false));
|
||||
if (mine != ISMINE_NO) {
|
||||
ret.push_back(Pair("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true: false));
|
||||
Object detail = boost::apply_visitor(DescribeAddressVisitor(mine), dest);
|
||||
ret.insert(ret.end(), detail.begin(), detail.end());
|
||||
}
|
||||
if (pwalletMain && pwalletMain->mapAddressBook.count(dest))
|
||||
|
||||
Reference in New Issue
Block a user