Skip to content

Support fetching 'verifiable' transactions #10126

@kayabaNerve

Description

@kayabaNerve

Right now, transactions can be fetched as either full transactions or as pruned transactions, where they have no signatures and solely the hash of their signatures. For version 2 transactions, this is sufficient to calculate the transaction's hash. For version 1, it is not. Anyone who wishes to verify the version 1 transaction is the requested transaction must make a follow-up request for the full version 1 transaction.

Ideally, I can flag I want verifiable transactions, defined as:

  • Full V1 transactions
  • Pruned V2 transactions, with the hashes of their prunable sections

This can potentially be done simply. For the following block,

if (req.split || req.prune || pruned)
{
// use split form with pruned and prunable (filled only when prune=false and the daemon has it), leaving as_hex as empty
e.pruned_as_hex = string_tools::buff_to_hex_nodelimer(std::get<1>(tx));
if (!req.prune)
e.prunable_as_hex = string_tools::buff_to_hex_nodelimer(std::get<3>(tx));

(!req.prune || (v1_transaction && req.verifiable))

may be sufficient as an alternative condition on the if check. This would resolve it for /get_transactions, but ideally the same change is also made for /get_blocks.bin and any other methods returning potentially-pruned transactions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions