Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

FRAME: Minor fix for failsafe. #13741

Merged
merged 5 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ pub mod pallet {
// Gah!! We have a non-zero reserve balance but no provider refs :(
// This shouldn't practically happen, but we need a failsafe anyway: let's give
// them enough for an ED.
a.free = a.free.min(Self::ed());
a.free = a.free.max(Self::ed());
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
system::Pallet::<T>::inc_providers(who);
}
let _ = system::Pallet::<T>::inc_consumers(who).defensive();
Expand Down
6 changes: 1 addition & 5 deletions frame/nis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,6 @@ pub mod pallet {
AlreadyCommunal,
/// The receipt is already private.
AlreadyPrivate,
Release1,
Release2,
Tah,
}

pub(crate) struct WeightCounter {
Expand Down Expand Up @@ -724,8 +721,7 @@ pub mod pallet {
let dropped = receipt.proportion.is_zero();

if amount > on_hold {
T::Currency::release(&T::HoldReason::get(), &who, on_hold, Exact)
.map_err(|_| Error::<T>::Release1)?;
T::Currency::release(&T::HoldReason::get(), &who, on_hold, Exact)?;
let deficit = amount - on_hold;
// Try to transfer deficit from pot to receipt owner.
summary.receipts_on_hold.saturating_reduce(on_hold);
Expand Down