GUI: TransactionRecord: Use "any from me" as the criteria for deciding whether a transaction is a send or receive

This changes behaviour (IMO for the better) in the case where some but not all inputs are from us, and the net amount is positive.
pull/28545/head
Luke Dashjr 6 years ago
parent 25290071c4
commit b9765ba1d6

@ -13,6 +13,7 @@
#include <QDateTime>
using wallet::ISMINE_NO;
using wallet::ISMINE_SPENDABLE;
using wallet::ISMINE_WATCH_ONLY;
using wallet::isminetype;
@ -39,8 +40,21 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
uint256 hash = wtx.tx->GetHash();
std::map<std::string, std::string> mapValue = wtx.value_map;
if (nNet > 0 || wtx.is_coinbase)
{
bool involvesWatchAddress = false;
isminetype fAllFromMe = ISMINE_SPENDABLE;
bool any_from_me = false;
if (wtx.is_coinbase) {
fAllFromMe = ISMINE_NO;
} else {
for (const isminetype mine : wtx.txin_is_mine)
{
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
if(fAllFromMe > mine) fAllFromMe = mine;
if (mine) any_from_me = true;
}
}
if (!any_from_me) {
//
// Credit
//
@ -78,14 +92,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
}
else
{
bool involvesWatchAddress = false;
isminetype fAllFromMe = ISMINE_SPENDABLE;
for (const isminetype mine : wtx.txin_is_mine)
{
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
if(fAllFromMe > mine) fAllFromMe = mine;
}
isminetype fAllToMe = ISMINE_SPENDABLE;
for (const isminetype mine : wtx.txout_is_mine)
{

Loading…
Cancel
Save