From 0a92514b6afaabcf1c5a1ce3a18db16177ce213c Mon Sep 17 00:00:00 2001 From: DangerousFreedom1984 <98208928+DangerousFreedom1984@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:07:24 +0200 Subject: [PATCH] add operator== to JamtisPaymentProposals (#18) * add operator== to JamtisPaymentProposals --------- Co-authored-by: DangerousFreedom \ --- src/seraphis_core/jamtis_payment_proposal.cpp | 13 +++++++++++++ src/seraphis_core/jamtis_payment_proposal.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/seraphis_core/jamtis_payment_proposal.cpp b/src/seraphis_core/jamtis_payment_proposal.cpp index 74b7d862f8..667396d00a 100644 --- a/src/seraphis_core/jamtis_payment_proposal.cpp +++ b/src/seraphis_core/jamtis_payment_proposal.cpp @@ -99,6 +99,19 @@ static void get_output_proposal_address_parts_v1(const rct::key &q, } //------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------- +/// equality operators +bool operator==(const JamtisPaymentProposalV1 a, const JamtisPaymentProposalV1 b) +{ + return a.destination == b.destination && a.amount == b.amount && + a.enote_ephemeral_privkey == b.enote_ephemeral_privkey && a.partial_memo == b.partial_memo; +} +//------------------------------------------------------------------------------------------------------------------- +bool operator==(const JamtisPaymentProposalSelfSendV1 a, const JamtisPaymentProposalSelfSendV1 b) +{ + return a.destination == b.destination && a.amount == b.amount && a.type == b.type && + a.enote_ephemeral_privkey == b.enote_ephemeral_privkey && a.partial_memo == b.partial_memo; +} +//------------------------------------------------------------------------------------------------------------------- void get_enote_ephemeral_pubkey(const JamtisPaymentProposalV1 &proposal, crypto::x25519_pubkey &enote_ephemeral_pubkey_out) { diff --git a/src/seraphis_core/jamtis_payment_proposal.h b/src/seraphis_core/jamtis_payment_proposal.h index 6d737a1224..06ea329aef 100644 --- a/src/seraphis_core/jamtis_payment_proposal.h +++ b/src/seraphis_core/jamtis_payment_proposal.h @@ -91,6 +91,10 @@ struct JamtisPaymentProposalSelfSendV1 final TxExtra partial_memo; }; +/// equality operators +bool operator==(const JamtisPaymentProposalV1 a, const JamtisPaymentProposalV1 b); +bool operator==(const JamtisPaymentProposalSelfSendV1 a, const JamtisPaymentProposalSelfSendV1 b); + /** * brief: get_enote_ephemeral_pubkey - get the proposal's enote ephemeral pubkey xK_e * param: proposal -