mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 13:15:41 +00:00
@@ -216,7 +216,7 @@ benchmarks! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ensure_updated {
|
ensure_updated {
|
||||||
let n in 0..MAX_HASH_UPGRADE_BULK_COUNT;
|
let n in 1..MAX_HASH_UPGRADE_BULK_COUNT;
|
||||||
|
|
||||||
let caller = funded_account::<T>();
|
let caller = funded_account::<T>();
|
||||||
let hashes = (0..n).map(|i| insert_old_unrequested::<T>(i)).collect::<Vec<_>>();
|
let hashes = (0..n).map(|i| insert_old_unrequested::<T>(i)).collect::<Vec<_>>();
|
||||||
|
|||||||
@@ -156,6 +156,8 @@ pub mod pallet {
|
|||||||
NotRequested,
|
NotRequested,
|
||||||
/// More than `MAX_HASH_UPGRADE_BULK_COUNT` hashes were requested to be upgraded at once.
|
/// More than `MAX_HASH_UPGRADE_BULK_COUNT` hashes were requested to be upgraded at once.
|
||||||
TooMany,
|
TooMany,
|
||||||
|
/// Too few hashes were requested to be upgraded (i.e. zero).
|
||||||
|
TooFew,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A reason for this pallet placing a hold on funds.
|
/// A reason for this pallet placing a hold on funds.
|
||||||
@@ -242,6 +244,7 @@ pub mod pallet {
|
|||||||
hashes: Vec<T::Hash>,
|
hashes: Vec<T::Hash>,
|
||||||
) -> DispatchResultWithPostInfo {
|
) -> DispatchResultWithPostInfo {
|
||||||
ensure_signed(origin)?;
|
ensure_signed(origin)?;
|
||||||
|
ensure!(hashes.len() > 0, Error::<T>::TooFew);
|
||||||
ensure!(hashes.len() <= MAX_HASH_UPGRADE_BULK_COUNT as usize, Error::<T>::TooMany);
|
ensure!(hashes.len() <= MAX_HASH_UPGRADE_BULK_COUNT as usize, Error::<T>::TooMany);
|
||||||
|
|
||||||
let updated = hashes.iter().map(Self::do_ensure_updated).filter(|b| *b).count() as u32;
|
let updated = hashes.iter().map(Self::do_ensure_updated).filter(|b| *b).count() as u32;
|
||||||
|
|||||||
Reference in New Issue
Block a user