carrot_core: refactor from tools:variant -> std::variant
This commit is contained in:
@@ -52,7 +52,7 @@ rct::key calculate_amount_commitment(const lazy_amount_commitment_t &lazy_amount
|
|||||||
rct::key operator()(const rct::xmr_amount &a) const { return rct::zeroCommit(a); }
|
rct::key operator()(const rct::xmr_amount &a) const { return rct::zeroCommit(a); }
|
||||||
};
|
};
|
||||||
|
|
||||||
return lazy_amount_commitment.visit(lazy_amount_commitment_visitor{});
|
return std::visit(lazy_amount_commitment_visitor{}, lazy_amount_commitment);
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
} //namespace carrot
|
} //namespace carrot
|
||||||
|
|||||||
@@ -29,20 +29,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//local headers
|
//local headers
|
||||||
#include "common/variant.h"
|
|
||||||
#include "ringct/rctTypes.h"
|
#include "ringct/rctTypes.h"
|
||||||
|
|
||||||
//third party headers
|
//third party headers
|
||||||
|
|
||||||
//standard headers
|
//standard headers
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <variant>
|
||||||
|
|
||||||
//forward declarations
|
//forward declarations
|
||||||
|
|
||||||
|
|
||||||
namespace carrot
|
namespace carrot
|
||||||
{
|
{
|
||||||
using lazy_amount_commitment_t = tools::variant<
|
using lazy_amount_commitment_t = std::variant<
|
||||||
rct::key, // C
|
rct::key, // C
|
||||||
std::pair<rct::xmr_amount, rct::key>, // (a, z) s.t. C = z G + a H
|
std::pair<rct::xmr_amount, rct::key>, // (a, z) s.t. C = z G + a H
|
||||||
rct::xmr_amount // a s.t. C = G + a H
|
rct::xmr_amount // a s.t. C = G + a H
|
||||||
|
|||||||
@@ -193,9 +193,6 @@ void get_output_enote_proposals(const std::vector<CarrotPaymentProposalV1> &norm
|
|||||||
CHECK_AND_ASSERT_THROW_MES(has_unique_randomness,
|
CHECK_AND_ASSERT_THROW_MES(has_unique_randomness,
|
||||||
"get output enote proposals: normal payment proposals contain duplicate anchor_norm AKA randomness");
|
"get output enote proposals: normal payment proposals contain duplicate anchor_norm AKA randomness");
|
||||||
|
|
||||||
// input_context = "R" || KI_1
|
|
||||||
const input_context_t input_context= make_carrot_input_context(tx_first_key_image);
|
|
||||||
|
|
||||||
// construct normal enotes
|
// construct normal enotes
|
||||||
output_enote_proposals_out.reserve(num_proposals);
|
output_enote_proposals_out.reserve(num_proposals);
|
||||||
for (size_t i = 0; i < normal_payment_proposals.size(); ++i)
|
for (size_t i = 0; i < normal_payment_proposals.size(); ++i)
|
||||||
@@ -327,9 +324,6 @@ void get_coinbase_output_enotes(const std::vector<CarrotPaymentProposalV1> &norm
|
|||||||
CHECK_AND_ASSERT_THROW_MES(has_unique_randomness,
|
CHECK_AND_ASSERT_THROW_MES(has_unique_randomness,
|
||||||
"get coinbase output enotes: normal payment proposals contain duplicate anchor_norm AKA randomness");
|
"get coinbase output enotes: normal payment proposals contain duplicate anchor_norm AKA randomness");
|
||||||
|
|
||||||
// input_context = "C" || IntToBytes256(block_index)
|
|
||||||
const input_context_t input_context = make_carrot_input_context_coinbase(block_index);
|
|
||||||
|
|
||||||
// construct normal enotes
|
// construct normal enotes
|
||||||
output_coinbase_enotes_out.reserve(num_proposals);
|
output_coinbase_enotes_out.reserve(num_proposals);
|
||||||
for (size_t i = 0; i < normal_payment_proposals.size(); ++i)
|
for (size_t i = 0; i < normal_payment_proposals.size(); ++i)
|
||||||
|
|||||||
Reference in New Issue
Block a user