aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-10-13 22:11:52 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-10-13 22:11:52 +0100
commit253ed76ef4c55160d9defb673676943313da7786 (patch)
tree89ede84b163ff9604b701f95c5d988ca7f8bb7f4 /src
parentcore_rpc_server: add a getblock RPC command, and fix print_block (diff)
downloadmonero-253ed76ef4c55160d9defb673676943313da7786.tar.xz
core_rpc_server: add optional json decoded tx to COMMAND_RPC_GET_TRANSACTIONS
Diffstat (limited to 'src')
-rw-r--r--src/rpc/core_rpc_server.cpp2
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 248ba17ac..08005ec72 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -253,6 +253,8 @@ namespace cryptonote
{
blobdata blob = t_serializable_object_to_blob(tx);
res.txs_as_hex.push_back(string_tools::buff_to_hex_nodelimer(blob));
+ if (req.decode_as_json)
+ res.txs_as_json.push_back(obj_to_json_str(tx));
}
BOOST_FOREACH(const auto& miss_tx, missed_txs)
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 511a74bf1..cb8845e8c 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -95,9 +95,11 @@ namespace cryptonote
struct request
{
std::list<std::string> txs_hashes;
+ bool decode_as_json;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(txs_hashes)
+ KV_SERIALIZE(decode_as_json)
END_KV_SERIALIZE_MAP()
};
@@ -106,11 +108,13 @@ namespace cryptonote
{
std::list<std::string> txs_as_hex; //transactions blobs as hex
std::list<std::string> missed_tx; //not found transactions
+ std::list<std::string> txs_as_json; //transactions decoded as json
std::string status;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(txs_as_hex)
KV_SERIALIZE(missed_tx)
+ KV_SERIALIZE(txs_as_json)
KV_SERIALIZE(status)
END_KV_SERIALIZE_MAP()
};