Skip to content
Snippets Groups Projects
Commit 3c988ea7 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Read locks once and not 2 times (#2394)

parent 9a5377df
No related merge requests found
......@@ -711,9 +711,14 @@ where
if locks.is_empty() {
return Ok(())
}
let now = <system::Module<T>>::block_number();
if Self::locks(who).into_iter()
.all(|l| now >= l.until || new_balance >= l.amount || !l.reasons.contains(reason))
if locks.into_iter()
.all(|l|
now >= l.until
|| new_balance >= l.amount
|| !l.reasons.contains(reason)
)
{
Ok(())
} else {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment