Browse Source

Showing 'involvesWatchonly' property for transactions returned by 'listtransactions' and 'listsinceblock'.

It is only appended when the transaction involves a watchonly address.
0.10
JaSK 11 years ago
parent
commit
952877e01c
  1. 5
      src/rpcwallet.cpp
  2. 4
      src/wallet.h

5
src/rpcwallet.cpp

@ -1117,6 +1117,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount); wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount);
bool fAllAccounts = (strAccount == string("*")); bool fAllAccounts = (strAccount == string("*"));
bool involvesWatchonly = wtx.IsFromMe(MINE_WATCH_ONLY);
// Sent // Sent
if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount)) if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
@ -1124,6 +1125,8 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64_t)& s, listSent) BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64_t)& s, listSent)
{ {
Object entry; Object entry;
if(involvesWatchonly || (::IsMine(*pwalletMain, s.first) & MINE_WATCH_ONLY))
entry.push_back(Pair("involvesWatchonly", true));
entry.push_back(Pair("account", strSentAccount)); entry.push_back(Pair("account", strSentAccount));
MaybePushAddress(entry, s.first); MaybePushAddress(entry, s.first);
entry.push_back(Pair("category", "send")); entry.push_back(Pair("category", "send"));
@ -1146,6 +1149,8 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
if (fAllAccounts || (account == strAccount)) if (fAllAccounts || (account == strAccount))
{ {
Object entry; Object entry;
if(involvesWatchonly || (::IsMine(*pwalletMain, r.first) & MINE_WATCH_ONLY))
entry.push_back(Pair("involvesWatchonly", true));
entry.push_back(Pair("account", account)); entry.push_back(Pair("account", account));
MaybePushAddress(entry, r.first); MaybePushAddress(entry, r.first);
if (wtx.IsCoinBase()) if (wtx.IsCoinBase())

4
src/wallet.h

@ -761,9 +761,9 @@ public:
void GetAccountAmounts(const std::string& strAccount, int64_t& nReceived, void GetAccountAmounts(const std::string& strAccount, int64_t& nReceived,
int64_t& nSent, int64_t& nFee, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const; int64_t& nSent, int64_t& nFee, const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const;
bool IsFromMe() const bool IsFromMe(const isminefilter& filter=(MINE_SPENDABLE|MINE_WATCH_ONLY)) const
{ {
return (GetDebit() > 0); return (GetDebit(filter) > 0);
} }
bool IsTrusted() const bool IsTrusted() const

Loading…
Cancel
Save