-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Labels
Description
We currently throw away all xt information if it has failed:
In function
substrate-api-client/src/api/rpc_api/author.rs
Lines 309 to 330 in 47d1173
| async fn submit_and_watch_opaque_extrinsic_until( | |
| &self, | |
| encoded_extrinsic: &Bytes, | |
| watch_until: XtStatus, | |
| ) -> Result<ExtrinsicReport<Self::Hash>> { | |
| let mut report = self | |
| .submit_and_watch_opaque_extrinsic_until_without_events(encoded_extrinsic, watch_until) | |
| .await?; | |
| if watch_until < XtStatus::InBlock { | |
| return Ok(report) | |
| } | |
| let block_hash = report.block_hash.ok_or(Error::BlockHashNotFound)?; | |
| let extrinsic_events = | |
| self.fetch_events_for_extrinsic(block_hash, report.extrinsic_hash).await?; | |
| // Ensure that the extrins has been successful. If not, return an error. | |
| for event in &extrinsic_events { | |
| event.check_if_failed()?; | |
| } | |
| report.events = Some(extrinsic_events); | |
| Ok(report) | |
| } |
We only return the dispatch error if the xt has failed. This only tells us why the extrinsic has failed, but not the xt_hash, nor the events for it. Even though it has been fetched previously.
So I'm proposing to return an Error that returns all the information: see #616