core_rpc_server: add optional json decoded tx to COMMAND_RPC_GET_TRANSACTIONS

This commit is contained in:
moneromooo-monero 2015-10-13 22:11:52 +01:00
parent ca23c0e5c8
commit 253ed76ef4
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 6 additions and 0 deletions

View file

@ -253,6 +253,8 @@ namespace cryptonote
{ {
blobdata blob = t_serializable_object_to_blob(tx); blobdata blob = t_serializable_object_to_blob(tx);
res.txs_as_hex.push_back(string_tools::buff_to_hex_nodelimer(blob)); 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) BOOST_FOREACH(const auto& miss_tx, missed_txs)

View file

@ -95,9 +95,11 @@ namespace cryptonote
struct request struct request
{ {
std::list<std::string> txs_hashes; std::list<std::string> txs_hashes;
bool decode_as_json;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(txs_hashes) KV_SERIALIZE(txs_hashes)
KV_SERIALIZE(decode_as_json)
END_KV_SERIALIZE_MAP() 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> txs_as_hex; //transactions blobs as hex
std::list<std::string> missed_tx; //not found transactions std::list<std::string> missed_tx; //not found transactions
std::list<std::string> txs_as_json; //transactions decoded as json
std::string status; std::string status;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(txs_as_hex) KV_SERIALIZE(txs_as_hex)
KV_SERIALIZE(missed_tx) KV_SERIALIZE(missed_tx)
KV_SERIALIZE(txs_as_json)
KV_SERIALIZE(status) KV_SERIALIZE(status)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };