Unverified Commit 6331b874 authored by Shawn Tabrizi's avatar Shawn Tabrizi Committed by GitHub
Browse files

Update xcm/xcm-builder/src/weight.rs


Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
parent 092d491c
Pipeline #156023 failed with stages
in 4 minutes and 5 seconds
......@@ -89,12 +89,12 @@ where
Instruction<C>: xcm::GetWeight<W>,
{
fn weight_with_limit(message: &Xcm<C>, instrs_limit: &mut u32) -> Result<Weight, ()> {
let mut r: Weight = 0;
*instrs_limit = instrs_limit.checked_sub(message.0.len() as u32).ok_or(())?;
for m in message.0.iter() {
r = r.checked_add(Self::instr_weight_with_limit(m, instrs_limit)?).ok_or(())?;
}
Ok(r)
message.0.iter().try_fold(0, |acc, x|
Self::instr_weight_with_limit(m, instrs_limit).and_then(|inst_weight| {
acc.checked_add(x)
})
).ok_or(())
}
fn instr_weight_with_limit(
instruction: &Instruction<C>,
......
Supports Markdown
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