Browse Source
Merge pull request #39 from adityapk00/master
Handle resolution errors at startup
checkpoints
Denio
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
0 deletions
-
lib/src/lightclient.rs
|
|
@ -75,6 +75,13 @@ impl LightClientConfig { |
|
|
|
} |
|
|
|
|
|
|
|
pub fn create(server: http::Uri, dangerous: bool) -> io::Result<(LightClientConfig, u64)> { |
|
|
|
use std::net::ToSocketAddrs; |
|
|
|
// Test for a connection first
|
|
|
|
format!("{}:{}", server.host().unwrap(), server.port_part().unwrap()) |
|
|
|
.to_socket_addrs()? |
|
|
|
.next() |
|
|
|
.ok_or(std::io::Error::new(ErrorKind::ConnectionRefused, "Couldn't resolve server!"))?; |
|
|
|
|
|
|
|
// Do a getinfo first, before opening the wallet
|
|
|
|
let info = grpcconnector::get_info(server.clone(), dangerous) |
|
|
|
.map_err(|e| std::io::Error::new(ErrorKind::ConnectionRefused, e))?; |
|
|
|