mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
testing: Retry constructing lightclient on read-proof errors
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -244,7 +244,7 @@ async fn build_light_client<T: Config>(proc: &SubstrateNode) -> Result<LightClie
|
|||||||
// Wait for at least 3 blocks before starting the light client.
|
// Wait for at least 3 blocks before starting the light client.
|
||||||
// Otherwise, the lightclient might error with
|
// Otherwise, the lightclient might error with
|
||||||
// `"Error when retrieving the call proof: No node available for call proof query"`.
|
// `"Error when retrieving the call proof: No node available for call proof query"`.
|
||||||
super::wait_for_number_of_blocks(&client, 3).await;
|
super::wait_for_number_of_blocks(&client, 4).await;
|
||||||
|
|
||||||
// Step 2. Construct the light client.
|
// Step 2. Construct the light client.
|
||||||
// P2p bootnode.
|
// P2p bootnode.
|
||||||
@@ -254,9 +254,27 @@ async fn build_light_client<T: Config>(proc: &SubstrateNode) -> Result<LightClie
|
|||||||
proc.p2p_address()
|
proc.p2p_address()
|
||||||
);
|
);
|
||||||
|
|
||||||
LightClientBuilder::new()
|
let mut result = LightClientBuilder::new()
|
||||||
.bootnodes([bootnode.as_str()])
|
.bootnodes([bootnode.as_str()])
|
||||||
.build_from_url(ws_url.as_str())
|
.build_from_url(ws_url.as_str())
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("Failed to construct light client {}", e))
|
.map_err(|e| format!("Failed to construct light client {}", e));
|
||||||
|
|
||||||
|
for _ in 0..3 {
|
||||||
|
if let Err(e) = &result {
|
||||||
|
if e.contains("Error when retrieving the call proof") {
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
|
||||||
|
|
||||||
|
result = LightClientBuilder::new()
|
||||||
|
.bootnodes([bootnode.as_str()])
|
||||||
|
.build_from_url(ws_url.as_str())
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Failed to construct light client {}", e));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user