Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionrecord.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <qt/transactionrecord.h> | #include <qt/transactionrecord.h> | ||||
#include <cashaddrenc.h> | |||||
#include <chain.h> | #include <chain.h> | ||||
#include <chainparams.h> // For Params() | |||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <dstencode.h> | #include <dstencode.h> | ||||
#include <interfaces/wallet.h> | #include <interfaces/wallet.h> | ||||
#include <timedata.h> | #include <timedata.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <wallet/finaltx.h> | #include <wallet/finaltx.h> | ||||
#include <QDateTime> | #include <QDateTime> | ||||
Show All 33 Lines | if (nNet > Amount::zero() || wtx.is_coinbase) { | ||||
TransactionRecord sub(txid, nTime); | TransactionRecord sub(txid, nTime); | ||||
CTxDestination address; | CTxDestination address; | ||||
sub.idx = i; // vout index | sub.idx = i; // vout index | ||||
sub.credit = txout.nValue; | sub.credit = txout.nValue; | ||||
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY; | sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY; | ||||
if (wtx.txout_address_is_mine[i]) { | if (wtx.txout_address_is_mine[i]) { | ||||
// Received by Bitcoin Address | // Received by Bitcoin Address | ||||
sub.type = TransactionRecord::RecvWithAddress; | sub.type = TransactionRecord::RecvWithAddress; | ||||
sub.address = EncodeDestination(wtx.txout_address[i]); | sub.address = | ||||
EncodeCashAddr(wtx.txout_address[i], Params()); | |||||
} else { | } else { | ||||
// Received by IP connection (deprecated features), or a | // Received by IP connection (deprecated features), or a | ||||
// multisignature or other non-simple transaction | // multisignature or other non-simple transaction | ||||
sub.type = TransactionRecord::RecvFromOther; | sub.type = TransactionRecord::RecvFromOther; | ||||
sub.address = mapValue["from"]; | sub.address = mapValue["from"]; | ||||
} | } | ||||
if (wtx.is_coinbase) { | if (wtx.is_coinbase) { | ||||
// Generated | // Generated | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | if (nNet > Amount::zero() || wtx.is_coinbase) { | ||||
// Ignore parts sent to self, as this is usually the change | // Ignore parts sent to self, as this is usually the change | ||||
// from a transaction sent back to our own address. | // from a transaction sent back to our own address. | ||||
continue; | continue; | ||||
} | } | ||||
if (!boost::get<CNoDestination>(&wtx.txout_address[nOut])) { | if (!boost::get<CNoDestination>(&wtx.txout_address[nOut])) { | ||||
// Sent to Bitcoin Address | // Sent to Bitcoin Address | ||||
sub.type = TransactionRecord::SendToAddress; | sub.type = TransactionRecord::SendToAddress; | ||||
sub.address = EncodeDestination(wtx.txout_address[nOut]); | sub.address = | ||||
EncodeCashAddr(wtx.txout_address[nOut], Params()); | |||||
} else { | } else { | ||||
// Sent to IP, or other non-address transaction like OP_EVAL | // Sent to IP, or other non-address transaction like OP_EVAL | ||||
sub.type = TransactionRecord::SendToOther; | sub.type = TransactionRecord::SendToOther; | ||||
sub.address = mapValue["to"]; | sub.address = mapValue["to"]; | ||||
} | } | ||||
Amount nValue = txout.nValue; | Amount nValue = txout.nValue; | ||||
/* Add fee to first output */ | /* Add fee to first output */ | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |