|
|
|
@ -939,6 +939,7 @@ bool t_rpc_command_executor::print_block_by_height(uint64_t height, bool include
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash,
|
|
|
|
|
bool include_metadata,
|
|
|
|
|
bool include_hex,
|
|
|
|
|
bool include_json) {
|
|
|
|
|
cryptonote::COMMAND_RPC_GET_TRANSACTIONS::request req;
|
|
|
|
@ -981,6 +982,29 @@ bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash,
|
|
|
|
|
const std::string &as_hex = (1 == res.txs.size()) ? res.txs.front().as_hex : res.txs_as_hex.front();
|
|
|
|
|
const std::string &pruned_as_hex = (1 == res.txs.size()) ? res.txs.front().pruned_as_hex : "";
|
|
|
|
|
const std::string &prunable_as_hex = (1 == res.txs.size()) ? res.txs.front().prunable_as_hex : "";
|
|
|
|
|
// Print metadata if requested
|
|
|
|
|
if (include_metadata)
|
|
|
|
|
{
|
|
|
|
|
if (!res.txs.front().in_pool)
|
|
|
|
|
{
|
|
|
|
|
tools::msg_writer() << "Block timestamp: " << res.txs.front().block_timestamp << " (" << tools::get_human_readable_timestamp(res.txs.front().block_timestamp) << ")";
|
|
|
|
|
}
|
|
|
|
|
cryptonote::blobdata blob;
|
|
|
|
|
if (epee::string_tools::parse_hexstr_to_binbuff(pruned_as_hex + prunable_as_hex, blob))
|
|
|
|
|
{
|
|
|
|
|
cryptonote::transaction tx;
|
|
|
|
|
if (cryptonote::parse_and_validate_tx_from_blob(blob, tx))
|
|
|
|
|
{
|
|
|
|
|
tools::msg_writer() << "Size: " << blob.size();
|
|
|
|
|
tools::msg_writer() << "Weight: " << cryptonote::get_transaction_weight(tx);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tools::fail_msg_writer() << "Error parsing transaction blob";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tools::fail_msg_writer() << "Error parsing transaction from hex";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Print raw hex if requested
|
|
|
|
|
if (include_hex)
|
|
|
|
|
{
|
|
|
|
|