mirror of
https://github.com/monero-project/monero.git
synced 2026-01-02 16:00:10 -08:00
rpc: allow getting pruned blocks from gettransactions
and get them pruned in find_and_save_rings, since it does not need the pruned data in the first place. Also set decode_to_json to false where missing, we don't need this either.
This commit is contained in:
@@ -209,6 +209,15 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
static cryptonote::blobdata get_pruned_tx_blob(cryptonote::transaction &tx)
|
||||
{
|
||||
std::stringstream ss;
|
||||
binary_archive<true> ba(ss);
|
||||
bool r = tx.serialize_base(ba);
|
||||
CHECK_AND_ASSERT_MES(r, cryptonote::blobdata(), "Failed to serialize rct signatures base");
|
||||
return ss.str();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
static cryptonote::blobdata get_pruned_tx_blob(const cryptonote::blobdata &blobdata)
|
||||
{
|
||||
cryptonote::transaction tx;
|
||||
@@ -216,14 +225,9 @@ namespace cryptonote
|
||||
if (!cryptonote::parse_and_validate_tx_from_blob(blobdata, tx))
|
||||
{
|
||||
MERROR("Failed to parse and validate tx from blob");
|
||||
return blobdata;
|
||||
return cryptonote::blobdata();
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
binary_archive<true> ba(ss);
|
||||
bool r = tx.serialize_base(ba);
|
||||
CHECK_AND_ASSERT_MES(r, blobdata, "Failed to serialize rct signatures base");
|
||||
return ss.str();
|
||||
return get_pruned_tx_blob(tx);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_get_blocks(const COMMAND_RPC_GET_BLOCKS_FAST::request& req, COMMAND_RPC_GET_BLOCKS_FAST::response& res)
|
||||
@@ -633,7 +637,7 @@ namespace cryptonote
|
||||
|
||||
crypto::hash tx_hash = *vhi++;
|
||||
e.tx_hash = *txhi++;
|
||||
blobdata blob = t_serializable_object_to_blob(tx);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user