mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Actually respect locks of zero (#14144)
* Actually thaw when locking zero. * Fixes * Just remove the lock if semantically viable --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -846,17 +846,18 @@ where
|
|||||||
|
|
||||||
type MaxLocks = T::MaxLocks;
|
type MaxLocks = T::MaxLocks;
|
||||||
|
|
||||||
// Set a lock on the balance of `who`.
|
// Set or alter a lock on the balance of `who`.
|
||||||
// Is a no-op if lock amount is zero or `reasons` `is_none()`.
|
|
||||||
fn set_lock(
|
fn set_lock(
|
||||||
id: LockIdentifier,
|
id: LockIdentifier,
|
||||||
who: &T::AccountId,
|
who: &T::AccountId,
|
||||||
amount: T::Balance,
|
amount: T::Balance,
|
||||||
reasons: WithdrawReasons,
|
reasons: WithdrawReasons,
|
||||||
) {
|
) {
|
||||||
if amount.is_zero() || reasons.is_empty() {
|
if reasons.is_empty() || amount.is_zero() {
|
||||||
|
Self::remove_lock(id, who);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut new_lock = Some(BalanceLock { id, amount, reasons: reasons.into() });
|
let mut new_lock = Some(BalanceLock { id, amount, reasons: reasons.into() });
|
||||||
let mut locks = Self::locks(who)
|
let mut locks = Self::locks(who)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
@@ -429,9 +429,9 @@ benchmarks! {
|
|||||||
+ 1 // offence
|
+ 1 // offence
|
||||||
+ 3 // reporter (reward + endowment)
|
+ 3 // reporter (reward + endowment)
|
||||||
+ 1 // offenders reported
|
+ 1 // offenders reported
|
||||||
+ 2 // offenders slashed
|
+ 3 // offenders slashed
|
||||||
+ 1 // offenders chilled
|
+ 1 // offenders chilled
|
||||||
+ 2 * n // nominators slashed
|
+ 3 * n // nominators slashed
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,9 +466,9 @@ benchmarks! {
|
|||||||
+ 1 // offence
|
+ 1 // offence
|
||||||
+ 3 // reporter (reward + endowment)
|
+ 3 // reporter (reward + endowment)
|
||||||
+ 1 // offenders reported
|
+ 1 // offenders reported
|
||||||
+ 2 // offenders slashed
|
+ 3 // offenders slashed
|
||||||
+ 1 // offenders chilled
|
+ 1 // offenders chilled
|
||||||
+ 2 * n // nominators slashed
|
+ 3 * n // nominators slashed
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user