Read locks once and not 2 times (#2394)

This commit is contained in:
Bastian Köcher
2019-04-27 14:14:00 +02:00
committed by GitHub
parent 9a5377dfc5
commit 3c988ea7e9
+7 -2
View File
@@ -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 {