mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 13:23:29 +01:00
core: add functions to serialize base tx info
That is, information without signatures (for v1) nor range proofs and MGs (for v2)
This commit is contained in:
parent
6fd4b827fb
commit
f113b92b93
@ -250,6 +250,28 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
END_SERIALIZE()
|
END_SERIALIZE()
|
||||||
|
|
||||||
|
template<bool W, template <bool> class Archive>
|
||||||
|
bool serialize_base(Archive<W> &ar)
|
||||||
|
{
|
||||||
|
FIELDS(*static_cast<transaction_prefix *>(this))
|
||||||
|
|
||||||
|
if (version == 1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ar.tag("rct_signatures");
|
||||||
|
if (!vin.empty())
|
||||||
|
{
|
||||||
|
ar.begin_object();
|
||||||
|
bool r = rct_signatures.serialize_rctsig_base(ar, vin.size(), vout.size());
|
||||||
|
if (!r || !ar.stream().good()) return false;
|
||||||
|
ar.end_object();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static size_t get_signature_size(const txin_v& tx_in);
|
static size_t get_signature_size(const txin_v& tx_in);
|
||||||
};
|
};
|
||||||
|
@ -93,6 +93,16 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
|
bool parse_and_validate_tx_base_from_blob(const blobdata& tx_blob, transaction& tx)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << tx_blob;
|
||||||
|
binary_archive<false> ba(ss);
|
||||||
|
bool r = tx.serialize_base(ba);
|
||||||
|
CHECK_AND_ASSERT_MES(r, false, "Failed to parse transaction from blob");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------
|
||||||
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash)
|
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
@ -44,6 +44,7 @@ namespace cryptonote
|
|||||||
crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx);
|
crypto::hash get_transaction_prefix_hash(const transaction_prefix& tx);
|
||||||
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash);
|
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx, crypto::hash& tx_hash, crypto::hash& tx_prefix_hash);
|
||||||
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx);
|
bool parse_and_validate_tx_from_blob(const blobdata& tx_blob, transaction& tx);
|
||||||
|
bool parse_and_validate_tx_base_from_blob(const blobdata& tx_blob, transaction& tx);
|
||||||
bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key);
|
bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key);
|
||||||
bool decrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key);
|
bool decrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user