diff options
author | jonnynewbs <jonnynewbs@gmail.com> | 2016-09-21 20:51:00 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2017-04-28 10:01:56 -0400 |
commit | 0ff9320bf5b60968669269b05b0eba65dd69c6b6 (patch) | |
tree | eac1dd4f4bd2efd2ef144528fa967557ea3030d5 /src/rest.cpp | |
parent | 4c924011f535c46b3bc02bef8b7e2a8ad559d78d (diff) |
refactor TxToJSON() and ScriptPubKeyToJSON()
Diffstat (limited to 'src/rest.cpp')
-rw-r--r-- | src/rest.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/rest.cpp b/src/rest.cpp index 9dcaf269d6..7537ed4502 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -5,6 +5,7 @@ #include "chain.h" #include "chainparams.h" +#include "core_io.h" #include "primitives/block.h" #include "primitives/transaction.h" #include "validation.h" @@ -56,10 +57,6 @@ struct CCoin { } }; -/* Defined in rawtransaction.cpp */ -void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry); -void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex); - static bool RESTERR(HTTPRequest* req, enum HTTPStatusCode status, std::string message) { req->WriteHeader("Content-Type", "text/plain"); @@ -383,7 +380,7 @@ static bool rest_tx(HTTPRequest* req, const std::string& strURIPart) case RF_JSON: { UniValue objTx(UniValue::VOBJ); - TxToJSON(*tx, hashBlock, objTx); + TxToUniv(*tx, hashBlock, objTx); std::string strJSON = objTx.write() + "\n"; req->WriteHeader("Content-Type", "application/json"); req->WriteReply(HTTP_OK, strJSON); @@ -577,7 +574,7 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart) // include the script in a json output UniValue o(UniValue::VOBJ); - ScriptPubKeyToJSON(coin.out.scriptPubKey, o, true); + ScriptPubKeyToUniv(coin.out.scriptPubKey, o, true); utxo.push_back(Pair("scriptPubKey", o)); utxos.push_back(utxo); } |