Skip to content

Commit

Permalink
Fix weight_limit for scheduled intructions (#1517)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Gabriel Jakabosky <[email protected]>
  • Loading branch information
HenriqueNogara and Neopallium authored Aug 31, 2023
1 parent 0e3cad2 commit 3b5f26a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pallets/settlement/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2076,8 +2076,17 @@ pub mod migration {
if let Some(block_number) = schedule {
// Cancel old scheduled task.
let _ = T::Scheduler::cancel_named(id.execution_name());
// Get the weight limit for the instruction
let instruction_legs: Vec<(LegId, Leg)> =
InstructionLegs::iter_prefix(&id).collect();
let instruction_asset_count = AssetCount::from_legs(&instruction_legs);
let weight_limit = Module::<T>::execute_scheduled_instruction_weight_limit(
instruction_asset_count.fungible(),
instruction_asset_count.non_fungible(),
instruction_asset_count.off_chain(),
);
// Create new scheduled task.
Module::<T>::schedule_instruction(id, block_number, Weight::MAX);
Module::<T>::schedule_instruction(id, block_number, weight_limit);
}

//Migrate Instruction details.
Expand Down

0 comments on commit 3b5f26a

Please sign in to comment.