From 9179b06d4a286cd2555df1d94cf8772c918e81d3 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Wed, 24 Feb 2016 01:32:18 +0300 Subject: [PATCH] Remove testnet condition --- src/qt/transactionrecord.cpp | 77 ++++++++++++++++-------------------------- 1 files changed, 29 insertions(+), 48 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index ec4ba10..7c50f91 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -46,65 +46,46 @@ QList TransactionRecord::decomposeTransaction(const CWallet * sub.idx = parts.size(); // sequence number sub.credit = txout.nValue; - if (!fTestNet) + txnouttype whichType; + std::vector vSolutions; + if (Solver(txout.scriptPubKey, whichType, vSolutions)) { CTxDestination address; - if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address)) + if (whichType == TX_PUBKEY) { - // Received by Bitcoin Address + // Pay-to-Pubkey + address = CPubKey(vSolutions[0]).GetID(); sub.type = TransactionRecord::RecvWithAddress; sub.address = CBitcoinAddress(address).ToString(); } - else + else if (whichType == TX_PUBKEYHASH) { - // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction - sub.type = TransactionRecord::RecvFromOther; - sub.address = mapValue["from"]; - } + // Pay-to-PubkeyHash + address = CKeyID(uint160(vSolutions[0])); + sub.type = TransactionRecord::RecvWithAddress; + sub.address = CBitcoinAddress(address).ToString(); } - else + else if (whichType == TX_SCRIPTHASH) { - txnouttype whichType; - std::vector vSolutions; - if (Solver(txout.scriptPubKey, whichType, vSolutions)) + // Pay-to-ScriptHash + address = CScriptID(uint160(vSolutions[0])); + sub.type = TransactionRecord::RecvWithAddress; + sub.address = CBitcoinAddress(address).ToString(); + } + else if (whichType == TX_PUBKEY_DROP) { - CTxDestination address; - if (whichType == TX_PUBKEY) - { - // Pay-to-Pubkey - address = CPubKey(vSolutions[0]).GetID(); - sub.type = TransactionRecord::RecvWithAddress; - sub.address = CBitcoinAddress(address).ToString(); - } - else if (whichType == TX_PUBKEYHASH) - { - // Pay-to-PubkeyHash - address = CKeyID(uint160(vSolutions[0])); - sub.type = TransactionRecord::RecvWithAddress; - sub.address = CBitcoinAddress(address).ToString(); - } - else if (whichType == TX_SCRIPTHASH) - { - // Pay-to-ScriptHash - address = CScriptID(uint160(vSolutions[0])); - sub.type = TransactionRecord::RecvWithAddress; - sub.address = CBitcoinAddress(address).ToString(); - } - else if (whichType == TX_PUBKEY_DROP) - { - // Pay-to-Pubkey-R - sub.type = TransactionRecord::RecvWithAddress; + // Pay-to-Pubkey-R + sub.type = TransactionRecord::RecvWithAddress; - CMalleableKeyView view; - pwalletMain->CheckOwnership(CPubKey(vSolutions[0]), CPubKey(vSolutions[1]), view); - sub.address = view.GetMalleablePubKey().ToString(); - } - else - { - // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction - sub.type = TransactionRecord::RecvFromOther; - sub.address = mapValue["from"]; - } + CMalleableKeyView view; + pwalletMain->CheckOwnership(CPubKey(vSolutions[0]), CPubKey(vSolutions[1]), view); + sub.address = view.GetMalleablePubKey().ToString(); + } + else + { + // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction + sub.type = TransactionRecord::RecvFromOther; + sub.address = mapValue["from"]; } } if (wtx.IsCoinBase()) -- 1.7.1