|
3 | 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | 4 |
|
5 | 5 | #include "transactionrecord.h" |
| 6 | +#include "omnicore/omnicore.h" |
| 7 | +#include "omnicore/pending.h" |
6 | 8 |
|
7 | 9 | #include "base58.h" |
8 | 10 | #include "timedata.h" |
9 | 11 | #include "wallet.h" |
10 | 12 |
|
11 | 13 | #include <stdint.h> |
12 | 14 |
|
| 15 | +using namespace mastercore; |
| 16 | + |
13 | 17 | /* Return positive answer if transaction should be shown in list. |
14 | 18 | */ |
15 | 19 | bool TransactionRecord::showTransaction(const CWalletTx &wtx) |
@@ -38,6 +42,34 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * |
38 | 42 | uint256 hash = wtx.GetHash(); |
39 | 43 | std::map<std::string, std::string> mapValue = wtx.mapValue; |
40 | 44 |
|
| 45 | + // Omni override - since we use multiple outputs these show up as multiple transaction records |
| 46 | + // and cause duplicate entries to be displayed in bitcoin history and overview recent |
| 47 | + bool omniOverride = false; |
| 48 | + PendingMap::iterator it = my_pending.find(hash); |
| 49 | + if (it != my_pending.end()) omniOverride = true; |
| 50 | + if (p_txlistdb->exists(hash)) omniOverride = true; |
| 51 | + if (omniOverride) { |
| 52 | + TransactionRecord sub(hash, nTime); |
| 53 | + sub.idx = parts.size(); |
| 54 | + sub.address = "Omni transaction"; |
| 55 | + sub.involvesWatchAddress = false; // watch only support for Omni is an ongoing WIP |
| 56 | + if (nNet > 0) { // inbound |
| 57 | + sub.type = TransactionRecord::RecvWithAddress; |
| 58 | + BOOST_FOREACH(const CTxOut& txout, wtx.vout) { |
| 59 | + isminetype mine = wallet->IsMine(txout); |
| 60 | + if (mine) { |
| 61 | + sub.credit += txout.nValue; |
| 62 | + if (mine == ISMINE_WATCH_ONLY) sub.involvesWatchAddress = true; |
| 63 | + } |
| 64 | + } |
| 65 | + } else { // outbound |
| 66 | + sub.type = TransactionRecord::SendToAddress; |
| 67 | + sub.debit = nNet; |
| 68 | + } |
| 69 | + parts.append(sub); |
| 70 | + return parts; |
| 71 | + } |
| 72 | + |
41 | 73 | if (nNet > 0 || wtx.IsCoinBase()) |
42 | 74 | { |
43 | 75 | // |
|
0 commit comments