From 5ac520cbb018b7a1b3037bb5934eec48c0efcc8d Mon Sep 17 00:00:00 2001 From: TWloYWkgQm9kbmFyaXU= Date: Mon, 12 Aug 2024 19:16:12 +0300 Subject: [PATCH] fix: bid distribution --- bid-distribution/src/settlement_claims.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bid-distribution/src/settlement_claims.rs b/bid-distribution/src/settlement_claims.rs index 2d9fc011..97734e77 100644 --- a/bid-distribution/src/settlement_claims.rs +++ b/bid-distribution/src/settlement_claims.rs @@ -78,10 +78,6 @@ pub fn generate_bid_settlements( Decimal::from(*settlement_config.marinade_fee_bps()) / Decimal::from(10000); let effective_bid = validator.effective_bid / Decimal::from(1000); - if sam_target_stake + mnde_target_stake == Decimal::ZERO { - continue; - } - let total_active_stake: u64 = stake_meta_index .iter_grouped_stake_metas(&validator.vote_account) .unwrap() @@ -90,7 +86,12 @@ pub fn generate_bid_settlements( .map(|meta| meta.active_delegation_lamports) .sum(); - let stake_sam_percentage = sam_target_stake / (sam_target_stake + mnde_target_stake); + let stake_sam_percentage = if mnde_target_stake == Decimal::ZERO { + Decimal::ONE + } else { + sam_target_stake / (sam_target_stake + mnde_target_stake) + }; + let initial_sam_stake = (Decimal::from(total_active_stake) * stake_sam_percentage) .to_u64() .unwrap();