Skip to content

Commit 9e9bb3f

Browse files
author
Conor Okus
committed
Merge branch 'examples' of github.com:ConorOkus/rust-lightning into examples
2 parents 0bd550f + ff34672 commit 9e9bb3f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/bitcoind-rpc-client/src/bitcoind_client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{sync::{Arc}};
1+
use std::{sync::{Arc}, io::{Result, Error, ErrorKind}};
22

33
use bitcoin::{BlockHash, Block};
44
use lightning_block_sync::{rpc::RpcClient, http::{HttpEndpoint}, BlockSource, AsyncBlockSourceResult, BlockHeaderData};
@@ -44,7 +44,7 @@ impl BlockSource for &BitcoindClient {
4444
}
4545

4646
impl BitcoindClient {
47-
pub async fn new(host: String, port: u16, rpc_user: String, rpc_password: String) -> std::io::Result<Self> {
47+
pub async fn new(host: String, port: u16, rpc_user: String, rpc_password: String) -> Result<Self> {
4848
let http_endpoint = HttpEndpoint::for_host(host.clone()).with_port(port);
4949
let rpc_creditials =
5050
base64::encode(format!("{}:{}", rpc_user.clone(), rpc_password.clone()));
@@ -53,7 +53,7 @@ impl BitcoindClient {
5353
.call_method::<BlockchainInfoResponse>("getblockchaininfo", &vec![])
5454
.await
5555
.map_err(|_| {
56-
std::io::Error::new(std::io::ErrorKind::PermissionDenied,
56+
Error::new(ErrorKind::PermissionDenied,
5757
"Failed to make initial call to bitcoind - please check your RPC user/password and access settings")
5858
})?;
5959

@@ -68,7 +68,7 @@ impl BitcoindClient {
6868
Ok(client)
6969
}
7070

71-
pub fn get_new_rpc_client(&self) -> std::io::Result<RpcClient> {
71+
pub fn get_new_rpc_client(&self) -> Result<RpcClient> {
7272
let http_endpoint = HttpEndpoint::for_host(self.host.clone()).with_port(self.port);
7373
let rpc_credentials =
7474
base64::encode(format!("{}:{}", self.rpc_user.clone(), self.rpc_password.clone()));

0 commit comments

Comments
 (0)