Skip to content

Commit

Permalink
Merge pull request #616 from zcoinofficial/add_remint_parsing
Browse files Browse the repository at this point in the history
Added remint parsing to getrawtransaction
  • Loading branch information
Putta Khunchalee authored Aug 16, 2019
2 parents cb79ae6 + 8402bdb commit d4fce31
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <boost/assign/list_of.hpp>
#include <univalue.h>
#include "sigma.h"
#include "sigma/remint.h"

using namespace std;

Expand Down Expand Up @@ -99,6 +100,21 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)

in.push_back(Pair("value", ValueFromAmount(spend->getIntDenomination())));
in.push_back(Pair("valueSat", spend->getIntDenomination()));
} else if (txin.IsZerocoinRemint()){
std::shared_ptr<sigma::CoinRemintToV3> remint;
try {
CDataStream serData(std::vector<unsigned char>(txin.scriptSig.begin()+1, txin.scriptSig.end()), SER_NETWORK, PROTOCOL_VERSION);
remint = std::make_shared<sigma::CoinRemintToV3>(serData);
in.push_back(Pair("publicCoinValue", remint->getPublicCoinValue().ToString(16)));
} catch (std::ios_base::failure &) {
throw JSONRPCError(RPC_DATABASE_ERROR, "An error occurred during processing the Zerocoin to Sigma remint information");
}
fillStdFields(in, txin);

CAmount const valueSat = remint->getDenomination() * COIN;

in.push_back(Pair("value", ValueFromAmount(valueSat)));
in.push_back(Pair("valueSat", valueSat));
} else {
in.push_back(Pair("txid", txin.prevout.hash.GetHex()));
in.push_back(Pair("vout", (int64_t)txin.prevout.n));
Expand Down

0 comments on commit d4fce31

Please sign in to comment.