Skip to content

Commit

Permalink
Showing 'involvesWatchonly' property for transactions returned by 'li…
Browse files Browse the repository at this point in the history
…sttransactions' and 'listsinceblock'.

It is only appended when the transaction involves a watchonly address.

Rebased-from: 952877e bitcoin#4045
  • Loading branch information
sdkfjlsfjlskdfjlsdjflsjf authored and wtogami committed Oct 2, 2014
1 parent 5215c72 commit 144e090
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1112,13 +1112,16 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount);

bool fAllAccounts = (strAccount == string("*"));
bool involvesWatchonly = wtx.IsFromMe(MINE_WATCH_ONLY);

// Sent
if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
{
BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64_t)& s, listSent)
{
Object entry;
if(involvesWatchonly || (::IsMine(*pwalletMain, s.first) & MINE_WATCH_ONLY))
entry.push_back(Pair("involvesWatchonly", true));
entry.push_back(Pair("account", strSentAccount));
MaybePushAddress(entry, s.first);
entry.push_back(Pair("category", "send"));
Expand All @@ -1141,6 +1144,8 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
if (fAllAccounts || (account == strAccount))
{
Object entry;
if(involvesWatchonly || (::IsMine(*pwalletMain, r.first) & MINE_WATCH_ONLY))
entry.push_back(Pair("involvesWatchonly", true));
entry.push_back(Pair("account", account));
MaybePushAddress(entry, r.first);
if (wtx.IsCoinBase())
Expand Down
4 changes: 2 additions & 2 deletions src/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,9 @@ class CWalletTx : public CMerkleTx
void GetAccountAmounts(const std::string& strAccount, int64_t& nReceived,
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
Expand Down

0 comments on commit 144e090

Please sign in to comment.