diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2018-12-15 04:20:46 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2023-06-23 02:05:19 +0000 |
commit | b9765ba1d67d7b74c17f9ce70cad5487715208a0 (patch) | |
tree | d86dddb4b23fdc7107c7c0602fd632af74a869dd /src | |
parent | 25290071c434638e2719a99784572deef44542ad (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/transactionrecord.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 26144ba197..4b48b124d4 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -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) { |