Skip to content

Commit

Permalink
More accurate dispatch_result: true/false (paritytech#1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur authored and serban300 committed Apr 10, 2024
1 parent d681a0a commit 501d207
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions bridges/bin/runtime-common/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,40 @@ pub mod target {
};

let xcm_outcome = do_dispatch();
log::trace!(
target: "runtime::bridge-dispatch",
"Incoming message {:?} dispatched with result: {:?}",
message_id,
xcm_outcome,
);
let dispatch_result = match xcm_outcome {
Ok(outcome) => {
log::trace!(
target: "runtime::bridge-dispatch",
"Incoming message {:?} dispatched with result: {:?}",
message_id,
outcome,
);
match outcome.ensure_execution() {
Ok(_weight) => true,
Err(e) => {
log::error!(
target: "runtime::bridge-dispatch",
"Incoming message {:?} was not dispatched, error: {:?}",
message_id,
e,
);
false
},
}
},
Err(e) => {
log::error!(
target: "runtime::bridge-dispatch",
"Incoming message {:?} was not dispatched, codec error: {:?}",
message_id,
e,
);
false
},
};

MessageDispatchResult {
dispatch_result: true,
dispatch_result,
unspent_weight: Weight::zero(),
dispatch_fee_paid_during_dispatch: false,
}
Expand Down

0 comments on commit 501d207

Please sign in to comment.