mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 23:15:42 +00:00
pallet-scheduler: Ensure we request a preimage (#13340)
* pallet-scheduler: Ensure we request a preimage The scheduler was not requesting a preimage. When a preimage is requested, a user can deposit it without paying any fees. * Review changes
This commit is contained in:
@@ -777,6 +777,8 @@ impl<T: Config> Pallet<T> {
|
||||
) -> Result<TaskAddress<T::BlockNumber>, DispatchError> {
|
||||
let when = Self::resolve_time(when)?;
|
||||
|
||||
let lookup_hash = call.lookup_hash();
|
||||
|
||||
// sanitize maybe_periodic
|
||||
let maybe_periodic = maybe_periodic
|
||||
.filter(|p| p.1 > 1 && !p.0.is_zero())
|
||||
@@ -790,7 +792,14 @@ impl<T: Config> Pallet<T> {
|
||||
origin,
|
||||
_phantom: PhantomData,
|
||||
};
|
||||
Self::place_task(when, task).map_err(|x| x.0)
|
||||
let res = Self::place_task(when, task).map_err(|x| x.0)?;
|
||||
|
||||
if let Some(hash) = lookup_hash {
|
||||
// Request the call to be made available.
|
||||
T::Preimages::request(&hash);
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
fn do_cancel(
|
||||
@@ -862,6 +871,8 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
let when = Self::resolve_time(when)?;
|
||||
|
||||
let lookup_hash = call.lookup_hash();
|
||||
|
||||
// sanitize maybe_periodic
|
||||
let maybe_periodic = maybe_periodic
|
||||
.filter(|p| p.1 > 1 && !p.0.is_zero())
|
||||
@@ -876,7 +887,14 @@ impl<T: Config> Pallet<T> {
|
||||
origin,
|
||||
_phantom: Default::default(),
|
||||
};
|
||||
Self::place_task(when, task).map_err(|x| x.0)
|
||||
let res = Self::place_task(when, task).map_err(|x| x.0)?;
|
||||
|
||||
if let Some(hash) = lookup_hash {
|
||||
// Request the call to be made available.
|
||||
T::Preimages::request(&hash);
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
fn do_cancel_named(origin: Option<T::PalletsOrigin>, id: TaskName) -> DispatchResult {
|
||||
@@ -1027,6 +1045,7 @@ impl<T: Config> Pallet<T> {
|
||||
} else {
|
||||
Agenda::<T>::remove(when);
|
||||
}
|
||||
|
||||
postponed == 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user