diff options
| author | Gavin Andresen <[email protected]> | 2012-01-03 09:24:54 -0800 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2012-01-03 09:24:54 -0800 |
| commit | 96d3bcb99690726d4c0e28355cc87c25e14f4c8d (patch) | |
| tree | 7c633a41fe714eda92ce08c24e143529fe0969e8 /src/qt/transactionrecord.cpp | |
| parent | Merge branch 'getblock' (diff) | |
| parent | Fix transaction type in UI: not all tx'es with "from"/"to" field are necessar... (diff) | |
| download | discoin-96d3bcb99690726d4c0e28355cc87c25e14f4c8d.tar.xz discoin-96d3bcb99690726d4c0e28355cc87c25e14f4c8d.zip | |
Merge pull request #731 from laanwj/txshowfix
Fix transaction type in UI
Diffstat (limited to 'src/qt/transactionrecord.cpp')
| -rw-r--r-- | src/qt/transactionrecord.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index f3dbd45c6..2cd135df3 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -64,17 +64,10 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * sub.credit = nUnmatured; } } - else if (!mapValue["from"].empty() || !mapValue["message"].empty()) - { - // Received by IP connection - sub.type = TransactionRecord::RecvFromIP; - if (!mapValue["from"].empty()) - sub.address = mapValue["from"]; - } else { + bool foundAddress = false; // Received by Bitcoin Address - sub.type = TransactionRecord::RecvWithAddress; BOOST_FOREACH(const CTxOut& txout, wtx.vout) { if(wallet->IsMine(txout)) @@ -82,11 +75,19 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * CBitcoinAddress address; if (ExtractAddress(txout.scriptPubKey, address) && wallet->HaveKey(address)) { + sub.type = TransactionRecord::RecvWithAddress; sub.address = address.ToString(); + foundAddress = true; + break; } - break; } } + if(!foundAddress) + { + // Received by IP connection, or other non-address transaction like OP_EVAL + sub.type = TransactionRecord::RecvFromOther; + sub.address = mapValue["from"]; + } } parts.append(sub); } @@ -127,21 +128,19 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * // from a transaction sent back to our own address. continue; } - else if(!mapValue["to"].empty()) + + CBitcoinAddress address; + if (ExtractAddress(txout.scriptPubKey, address)) { - // Sent to IP - sub.type = TransactionRecord::SendToIP; - sub.address = mapValue["to"]; + // Sent to Bitcoin Address + sub.type = TransactionRecord::SendToAddress; + sub.address = address.ToString(); } else { - // Sent to Bitcoin Address - sub.type = TransactionRecord::SendToAddress; - CBitcoinAddress address; - if (ExtractAddress(txout.scriptPubKey, address)) - { - sub.address = address.ToString(); - } + // Sent to IP, or other non-address transaction like OP_EVAL + sub.type = TransactionRecord::SendToOther; + sub.address = mapValue["to"]; } int64 nValue = txout.nValue; |