Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
UkoeHB committed Apr 24, 2024
1 parent f0eac25 commit 6674edc
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 120 deletions.
28 changes: 14 additions & 14 deletions src/seraphis_impl/enote_store_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ static boost::multiprecision::uint128_t get_balance_intermediate_legacy(
const std::uint64_t top_block_index,
const std::uint64_t default_spendable_age,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<BalanceExclusions> &exclusions)
const std::unordered_set<BalanceExclusion> &exclusions)
{
boost::multiprecision::uint128_t balance{0};

// 1. ignore if excluded
if (exclusions.find(BalanceExclusions::LEGACY_INTERMEDIATE) != exclusions.end())
if (exclusions.find(BalanceExclusion::LEGACY_INTERMEDIATE) != exclusions.end())
return 0;

// 2. accumulate balance
Expand All @@ -81,7 +81,7 @@ static boost::multiprecision::uint128_t get_balance_intermediate_legacy(
continue;

// b. ignore locked onchain enotes if they should be excluded
if (exclusions.find(BalanceExclusions::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
if (exclusions.find(BalanceExclusion::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
current_contextual_record.origin_context.origin_status == SpEnoteOriginStatus::ONCHAIN &&
onchain_legacy_enote_is_locked(
current_contextual_record.origin_context.block_index,
Expand Down Expand Up @@ -144,12 +144,12 @@ static boost::multiprecision::uint128_t get_balance_full_legacy(
const std::uint64_t default_spendable_age,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<SpEnoteSpentStatus> &spent_statuses,
const std::unordered_set<BalanceExclusions> &exclusions)
const std::unordered_set<BalanceExclusion> &exclusions)
{
boost::multiprecision::uint128_t balance{0};

// 1. ignore if excluded
if (exclusions.find(BalanceExclusions::LEGACY_FULL) != exclusions.end())
if (exclusions.find(BalanceExclusion::LEGACY_FULL) != exclusions.end())
return 0;

// 2. accumulate balance
Expand All @@ -166,7 +166,7 @@ static boost::multiprecision::uint128_t get_balance_full_legacy(
continue;

// c. ignore locked onchain enotes if they should be excluded
if (exclusions.find(BalanceExclusions::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
if (exclusions.find(BalanceExclusion::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
current_contextual_record.origin_context.origin_status == SpEnoteOriginStatus::ONCHAIN &&
onchain_legacy_enote_is_locked(
current_contextual_record.origin_context.block_index,
Expand Down Expand Up @@ -223,12 +223,12 @@ static boost::multiprecision::uint128_t get_balance_intermediate_seraphis(
const std::uint64_t top_block_index,
const std::uint64_t default_spendable_age,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<BalanceExclusions> &exclusions)
const std::unordered_set<BalanceExclusion> &exclusions)
{
boost::multiprecision::uint128_t received_sum{0};

// 1. ignore if excluded
if (exclusions.find(BalanceExclusions::SERAPHIS_INTERMEDIATE) != exclusions.end())
if (exclusions.find(BalanceExclusion::SERAPHIS_INTERMEDIATE) != exclusions.end())
return 0;

// 2. accumulate received sum
Expand All @@ -242,7 +242,7 @@ static boost::multiprecision::uint128_t get_balance_intermediate_seraphis(
continue;

// b. ignore locked onchain enotes if they should be excluded
if (exclusions.find(BalanceExclusions::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
if (exclusions.find(BalanceExclusion::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
current_contextual_record.origin_context.origin_status == SpEnoteOriginStatus::ONCHAIN &&
onchain_sp_enote_is_locked(
current_contextual_record.origin_context.block_index,
Expand All @@ -265,12 +265,12 @@ static boost::multiprecision::uint128_t get_balance_full_seraphis(
const std::uint64_t default_spendable_age,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<SpEnoteSpentStatus> &spent_statuses,
const std::unordered_set<BalanceExclusions> &exclusions)
const std::unordered_set<BalanceExclusion> &exclusions)
{
boost::multiprecision::uint128_t balance{0};

// 1. ignore if excluded
if (exclusions.find(BalanceExclusions::SERAPHIS_FULL) != exclusions.end())
if (exclusions.find(BalanceExclusion::SERAPHIS_FULL) != exclusions.end())
return 0;

// 2. accumulate balance
Expand All @@ -287,7 +287,7 @@ static boost::multiprecision::uint128_t get_balance_full_seraphis(
continue;

// c. ignore locked onchain enotes if they should be excluded
if (exclusions.find(BalanceExclusions::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
if (exclusions.find(BalanceExclusion::ORIGIN_LEDGER_LOCKED) != exclusions.end() &&
current_contextual_record.origin_context.origin_status == SpEnoteOriginStatus::ONCHAIN &&
onchain_sp_enote_is_locked(
current_contextual_record.origin_context.block_index,
Expand Down Expand Up @@ -458,7 +458,7 @@ scanning::ContiguityMarker get_nearest_sp_scanned_block(const SpEnoteStore &enot
boost::multiprecision::uint128_t get_balance(const SpEnoteStore &enote_store,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<SpEnoteSpentStatus> &spent_statuses,
const std::unordered_set<BalanceExclusions> &exclusions)
const std::unordered_set<BalanceExclusion> &exclusions)
{
boost::multiprecision::uint128_t balance{0};

Expand Down Expand Up @@ -492,7 +492,7 @@ boost::multiprecision::uint128_t get_balance(const SpEnoteStore &enote_store,
//-------------------------------------------------------------------------------------------------------------------
boost::multiprecision::uint128_t get_received_sum(const SpEnoteStorePaymentValidator &payment_validator,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<BalanceExclusions> &exclusions)
const std::unordered_set<BalanceExclusion> &exclusions)
{
boost::multiprecision::uint128_t received_sum{0};

Expand Down
8 changes: 4 additions & 4 deletions src/seraphis_impl/enote_store_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ namespace sp
{

////
// BalanceExclusions
// BalanceExclusion
// - Enotes that match with a balance exclusion will not be included in a balance calculation.
///
enum class BalanceExclusions
enum class BalanceExclusion
{
LEGACY_FULL,
LEGACY_INTERMEDIATE,
Expand Down Expand Up @@ -125,7 +125,7 @@ scanning::ContiguityMarker get_nearest_sp_scanned_block(const SpEnoteStore &enot
boost::multiprecision::uint128_t get_balance(const SpEnoteStore &enote_store,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<SpEnoteSpentStatus> &spent_statuses = {},
const std::unordered_set<BalanceExclusions> &exclusions = {});
const std::unordered_set<BalanceExclusion> &exclusions = {});
/**
* brief: get_balance - get current total amount received using specified origin statuses and exclusions
* param: payment_validator -
Expand All @@ -135,6 +135,6 @@ boost::multiprecision::uint128_t get_balance(const SpEnoteStore &enote_store,
*/
boost::multiprecision::uint128_t get_received_sum(const SpEnoteStorePaymentValidator &payment_validator,
const std::unordered_set<SpEnoteOriginStatus> &origin_statuses,
const std::unordered_set<BalanceExclusions> &exclusions = {});
const std::unordered_set<BalanceExclusion> &exclusions = {});

} //namespace sp
Loading

0 comments on commit 6674edc

Please sign in to comment.