Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ use log::*;
use my_node_runtime::{Hash, Header, RuntimeEvent};
use sgx_types::*;
use substrate_api_client::{
rpc::HandleSubscription, GetHeader, SubmitAndWatch, SubscribeChain, SubscribeEvents, XtStatus,
rpc::HandleSubscription, GetHeader, SubmitAndWatchUntilSuccess, SubscribeChain, SubscribeEvents,
};

#[cfg(feature = "dcap")]
Expand Down Expand Up @@ -785,12 +785,18 @@ fn send_extrinsic(
}

println!("[>] Register the TCB info (send the extrinsic)");
let register_qe_block_hash = api
.submit_and_watch_opaque_extrinsic_until(extrinsic.into(), XtStatus::Finalized)
.unwrap()
.block_hash;
println!("[<] Extrinsic got finalized. Block hash: {:?}\n", register_qe_block_hash);
register_qe_block_hash

match api.submit_and_watch_opaque_extrinsic_until_success(extrinsic.into(), true) {
Ok(xt_report) => {
let register_qe_block_hash = xt_report.block_hash;
println!("[<] Extrinsic got finalized. Block hash: {:?}\n", register_qe_block_hash);
register_qe_block_hash
},
Err(e) => {
error!("ExtrinsicFailed {:?}", e);
None
},
}
}

/// Subscribe to the node API finalized heads stream and trigger a parent chain sync
Expand Down