diff options
author | JaSK <temp@temp.temp> | 2014-04-05 21:36:48 +0200 |
---|---|---|
committer | JaSK <temp@temp.temp> | 2014-07-02 15:48:38 +0200 |
commit | d2692f61164730322547871f2124de06ade0436b (patch) | |
tree | 311a39b0f3fe010a7960aa29e41420b160ae7f55 /src/qt | |
parent | ffd40da361639faeef405c7e4a504a340d77aa5b (diff) |
Watchonly transactions are marked in transaction history
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/transactionrecord.cpp | 7 | ||||
-rw-r--r-- | src/qt/transactionrecord.h | 3 | ||||
-rw-r--r-- | src/qt/transactiontablemodel.cpp | 11 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 3d77d39893..1011363f3e 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -70,16 +70,19 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * sub.type = TransactionRecord::Generated; } + sub.involvesWatchAddress = mine == MINE_WATCH_ONLY; parts.append(sub); } } } else { + bool involvesWatchAddress = false; isminetype fAllFromMe = MINE_SPENDABLE; BOOST_FOREACH(const CTxIn& txin, wtx.vin) { isminetype mine = wallet->IsMine(txin); + if(mine == MINE_WATCH_ONLY) involvesWatchAddress = true; if(fAllFromMe > mine) fAllFromMe = mine; } @@ -87,6 +90,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * BOOST_FOREACH(const CTxOut& txout, wtx.vout) { isminetype mine = wallet->IsMine(txout); + if(mine == MINE_WATCH_ONLY) involvesWatchAddress = true; if(fAllToMe > mine) fAllToMe = mine; } @@ -97,6 +101,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "", -(nDebit - nChange), nCredit - nChange)); + parts.last().involvesWatchAddress = involvesWatchAddress; } else if (fAllFromMe) { @@ -141,6 +146,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * } sub.debit = -nValue; + sub.involvesWatchAddress = involvesWatchAddress; parts.append(sub); } } @@ -150,6 +156,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * // Mixed debit transaction, can't break down payees // parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, 0)); + parts.last().involvesWatchAddress = involvesWatchAddress; } } diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index 37679cebfa..d3cfa77d97 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -137,6 +137,9 @@ public: /** Status: can change with block chain update */ TransactionStatus status; + /** Whether the transaction was sent/received with a watch-only address */ + bool involvesWatchAddress; + /** Return the unique identifier for this transaction (part) */ QString getTxID() const; diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index a935752246..c357d26a9d 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -390,19 +390,22 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const { + // mark transactions involving watch-only addresses: + QString watchAddress = wtx->involvesWatchAddress ? " (w) " : ""; + switch(wtx->type) { case TransactionRecord::RecvFromOther: - return QString::fromStdString(wtx->address); + return QString::fromStdString(wtx->address) + watchAddress; case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: - return lookupAddress(wtx->address, tooltip); + return lookupAddress(wtx->address, tooltip) + watchAddress; case TransactionRecord::SendToOther: - return QString::fromStdString(wtx->address); + return QString::fromStdString(wtx->address) + watchAddress; case TransactionRecord::SendToSelf: default: - return tr("(n/a)"); + return tr("(n/a)") + watchAddress; } } |