From 918ad8a016584a1a98e82181b232619a7c42fe49 Mon Sep 17 00:00:00 2001 From: Alex Coats Date: Mon, 12 Feb 2024 09:13:56 -0500 Subject: [PATCH] fix(analytics): account for outputs with amount less than min deposit in ledger size analytics --- src/analytics/ledger/ledger_size.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/analytics/ledger/ledger_size.rs b/src/analytics/ledger/ledger_size.rs index 6d9adb7d1..39f8908b1 100644 --- a/src/analytics/ledger/ledger_size.rs +++ b/src/analytics/ledger/ledger_size.rs @@ -19,7 +19,9 @@ impl LedgerSize for Output { iota_sdk::types::block::output::Output::try_from_with_context(&protocol_params, self.clone()).unwrap(); let rent_bytes = RentStructureBytes::compute(&output); LedgerSizeMeasurement { - total_storage_deposit_amount: Rent::rent_cost(&output, protocol_params.rent_structure()).into(), + total_storage_deposit_amount: Rent::rent_cost(&output, protocol_params.rent_structure()) + .min(output.amount()) + .into(), total_key_bytes: rent_bytes.num_key_bytes, total_data_bytes: rent_bytes.num_data_bytes, }