carrot_impl: refactor for encrypted_payment_id_t type separation

This commit is contained in:
jeffro256
2025-05-19 14:44:58 -05:00
committed by akildemir
parent daffdd764b
commit bd34433be2
4 changed files with 21 additions and 2 deletions

View File

@@ -68,6 +68,12 @@ inline void serialize(Archive &a, carrot::encrypted_janus_anchor_t &x, const boo
}
//---------------------------------------------------
template <class Archive>
inline void serialize(Archive &a, carrot::payment_id_t &x, const boost::serialization::version_type ver)
{
a & x.bytes;
}
//---------------------------------------------------
template <class Archive>
inline void serialize(Archive &a, carrot::encrypted_payment_id_t &x, const boost::serialization::version_type ver)
{
a & x.bytes;

View File

@@ -40,3 +40,4 @@
BLOB_SERIALIZER(carrot::view_tag_t);
BLOB_SERIALIZER(carrot::encrypted_janus_anchor_t);
BLOB_SERIALIZER(carrot::encrypted_payment_id_t);

View File

@@ -42,7 +42,19 @@
//forward declarations
BLOB_SERIALIZER(carrot::payment_id_t);
BEGIN_SERIALIZE_OBJECT_FN(carrot::payment_id_t)
bool is_null = v == carrot::null_payment_id;
FIELD(is_null)
if (is_null)
{
v = carrot::null_payment_id;
}
else
{
ar.tag("data");
ar.serialize_blob(&v, sizeof(v));
}
END_SERIALIZE()
BEGIN_SERIALIZE_OBJECT_FN(carrot::CarrotDestinationV1)
FIELD_F(address_spend_pubkey)

View File

@@ -163,7 +163,7 @@ void make_carrot_transaction_proposal_v1(const std::vector<CarrotPaymentProposal
}
// generate random dummy encrypted payment ID for if none of the normal payment proposals are integrated
tx_proposal_out.dummy_encrypted_payment_id = gen_payment_id();
tx_proposal_out.dummy_encrypted_payment_id = gen_encrypted_payment_id();
// calculate the final size of tx.extra
const size_t tx_extra_size = get_carrot_default_tx_extra_size(num_outs) + extra.size();