Skip to content

Commit ca2f3f6

Browse files
authored
Merge pull request #2455 from subspace/fix-free-space-calculation
Fix free space calculation to account for min replication factor properly
2 parents eddad9d + 5adb607 commit ca2f3f6

File tree

1 file changed

+3
-4
lines changed
  • crates/pallet-transaction-fees/src

1 file changed

+3
-4
lines changed

crates/pallet-transaction-fees/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,9 @@ where
257257
pub fn calculate_transaction_byte_fee() -> BalanceOf<T> {
258258
let credit_supply = T::CreditSupply::get();
259259

260-
match T::TotalSpacePledged::get().checked_sub(
261-
T::BlockchainHistorySize::get()
262-
.saturating_mul(u128::from(T::MinReplicationFactor::get())),
263-
) {
260+
match (T::TotalSpacePledged::get() / u128::from(T::MinReplicationFactor::get()))
261+
.checked_sub(T::BlockchainHistorySize::get())
262+
{
264263
Some(free_space) if free_space > 0 => {
265264
credit_supply / BalanceOf::<T>::saturated_from(free_space)
266265
}

0 commit comments

Comments
 (0)