diff options
| author | Riccardo Spagni <ric@spagni.net> | 2018-09-21 20:46:00 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2018-09-21 20:46:00 +0200 |
| commit | fd74815f6562c3edb54fb9322ce77138992fa908 (patch) | |
| tree | ce3d27c14d08deba71e18cfcfc890f51af289f4d | |
| parent | 93f473e9f8c0cd33bd1207a529e4679514e82b25 (diff) | |
| parent | f77ce675cbf9e269d6fae09fef1385296bf708de (diff) | |
| download | monzero-core-fd74815f6562c3edb54fb9322ce77138992fa908.tar.gz monzero-core-fd74815f6562c3edb54fb9322ce77138992fa908.tar.xz monzero-core-fd74815f6562c3edb54fb9322ce77138992fa908.zip | |
Merge pull request #4399
f77ce675 rpc: allow pruning of json encoded txs (cryptochangements34)
| -rw-r--r-- | src/rpc/core_rpc_server.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 3508208bc..be511a2d2 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -221,6 +221,15 @@ namespace cryptonote return ss.str(); } //------------------------------------------------------------------------------------------------------------------------------ + static cryptonote::blobdata get_pruned_tx_json(cryptonote::transaction &tx) + { + std::stringstream ss; + json_archive<true> ar(ss); + bool r = tx.serialize_base(ar); + CHECK_AND_ASSERT_MES(r, cryptonote::blobdata(), "Failed to serialize rct signatures base"); + return ss.str(); + } + //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::on_get_blocks(const COMMAND_RPC_GET_BLOCKS_FAST::request& req, COMMAND_RPC_GET_BLOCKS_FAST::response& res) { PERF_TIMER(on_get_blocks); @@ -558,7 +567,7 @@ namespace cryptonote blobdata blob = req.prune ? get_pruned_tx_blob(tx) : t_serializable_object_to_blob(tx); e.as_hex = string_tools::buff_to_hex_nodelimer(blob); if (req.decode_as_json) - e.as_json = obj_to_json_str(tx); + e.as_json = req.prune ? get_pruned_tx_json(tx) : obj_to_json_str(tx); e.in_pool = pool_tx_hashes.find(tx_hash) != pool_tx_hashes.end(); if (e.in_pool) { |
