mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
FRAME: Minor fix for failsafe. (#13741)
* max instead of min * Remove debug stuff * remove debug code * warn log on no provider ref * format string for log --------- Co-authored-by: muharem <ismailov.m.h@gmail.com>
This commit is contained in:
@@ -786,7 +786,12 @@ 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());
|
||||
log::warn!(
|
||||
target: LOG_TARGET,
|
||||
"account with a non-zero reserve balance has no provider refs, account_id: '{:?}'.",
|
||||
who
|
||||
);
|
||||
a.free = a.free.max(Self::ed());
|
||||
system::Pallet::<T>::inc_providers(who);
|
||||
}
|
||||
let _ = system::Pallet::<T>::inc_consumers(who).defensive();
|
||||
|
||||
@@ -480,9 +480,6 @@ pub mod pallet {
|
||||
AlreadyCommunal,
|
||||
/// The receipt is already private.
|
||||
AlreadyPrivate,
|
||||
Release1,
|
||||
Release2,
|
||||
Tah,
|
||||
}
|
||||
|
||||
pub(crate) struct WeightCounter {
|
||||
@@ -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);
|
||||
@@ -756,8 +752,7 @@ pub mod pallet {
|
||||
)?;
|
||||
summary.receipts_on_hold.saturating_reduce(on_hold);
|
||||
}
|
||||
T::Currency::release(&T::HoldReason::get(), &who, amount, Exact)
|
||||
.map_err(|_| Error::<T>::Release2)?;
|
||||
T::Currency::release(&T::HoldReason::get(), &who, amount, Exact)?;
|
||||
}
|
||||
|
||||
if dropped {
|
||||
|
||||
Reference in New Issue
Block a user