| 678 | let src_path = entry.path(); |
| 679 | let dst_path = PathBuf::from(dst).join(entry.file_name()); |
| 680 | |
| 681 | if ty.is_dir() { |
| 682 | copy_dir_all( |
| 683 | src_path.to_str().expect("Invalid path"), |
| 684 | dst_path.to_str().expect("Invalid path"), |
| 685 | )?; |
| 686 | } else { |
| 687 | fs::copy(&src_path, &dst_path)?; |
| 688 | } |
| 689 | } |
| 690 | Ok(()) |
| 691 | } |
| 692 | |
| 693 | async fn get_latest_height(rpc_port: u16) -> Result<u64, Box<dyn std::error::Error>> { |
| 694 | let url = format!("http://localhost:{}", rpc_port); |
| 695 | let client = HttpClientBuilder::default().build(&url)?; |
| 696 | let height = client.get_latest_height().await?; |
| 697 | Ok(height) |
| 698 | } |
| 699 | |
| 700 | async fn get_latest_checkpoint( |
| 701 | rpc_port: u16, |
| 702 | ) -> Result<Option<Checkpoint>, Box<dyn std::error::Error>> { |
| 703 | let url = format!("http://localhost:{}", rpc_port); |
| 704 | let client = HttpClientBuilder::default().build(&url)?; |
| 705 | |
| 706 | match client.get_latest_checkpoint().await { |
| 707 | Ok(checkpoint_resp) => { |