From d53a4a9e5b4dcc0bf9e14e1e01b79ad1aa1cee8f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 7 Jan 2019 18:11:51 +0800 Subject: [PATCH] push changes for getrawtransaction --- src/rpc/rawtransaction.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 117d2ac34..9badcbd30 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -35,6 +35,7 @@ #include "script/sign.h" #include "script/standard.h" #include "uint256.h" +#include "importcoin.h" #ifdef ENABLE_WALLET #include "wallet/wallet.h" #endif @@ -202,6 +203,25 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue& in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); else if (tx.IsCoinImport()) { in.push_back(Pair("is_import", "1")); + TxProof proof; CTransaction burnTx; std::vector payouts; CTxDestination importaddress; + if (UnmarshalImportTx(tx, proof, burnTx, payouts)) + { + if (burnTx.vout.size() == 0) + continue; + in.push_back(Pair("txid", burnTx.GetHash().ToString())); + in.push_back(Pair("value", ValueFromAmount(burnTx.vout.back().nValue))); + in.push_back(Pair("valueSat", burnTx.vout.back().nValue)); + // extract op_return to get burn source chain. + std::vector burnOpret; std::string targetSymbol; uint32_t targetCCid; uint256 payoutsHash; std::vectorrawproof; + if (UnmarshalBurnTx(burnTx, targetSymbol, &targetCCid, payoutsHash, rawproof)) + { + if (rawproof.size() > 0) + { + std::string sourceSymbol(rawproof.begin(), rawproof.end()); + in.push_back(Pair("source", sourceSymbol)); + } + } + } } else { in.push_back(Pair("txid", txin.prevout.hash.GetHex()));