} pub(crate) fn request(&self, path: impl AsRef) -> Response { self.sync_server(); reqwest::blocking::get(self.url().join(path.as_ref()).unwrap()).unwrap() } pub(crate) fn json_request(&self, path: impl AsRef) -> Response { self.sync_server(); let client = reqwest::blocking::Client::new(); client .get(self.url().join(path.as_ref()).unwrap()) .header(reqwest::header::ACCEPT, "application/json") .send() .unwrap() } pub(crate) fn sync_server(&self) { let client = Client::new(&self.rpc_url, Auth::None).unwrap(); let chain_block_count = client.get_block_count().unwrap() + 1; for i in 0.. { let response = reqwest::blocking::get(self.url().join("/blockcount").unwrap()).unwrap(); assert_eq!(response.status(), StatusCode::OK); if response.text().unwrap().parse::().unwrap() == chain_block_count { break; } else if i == 20 { panic!("index failed to synchronize with chain"); } thread::sleep(Duration::from_millis(25));