X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-block-sync%2Fsrc%2Frpc.rs;h=e1dc43c8f28d65511c45ce32591ef9eb5b933e8b;hb=f75ad8021b5b46a1a7cb2b632bb9019a8d5f4eac;hp=6b4397a6b0fbe87d19a130fa18002a27042c9864;hpb=f1145158fe48e2610d139d4f2f1f420f46bfc8bd;p=rust-lightning diff --git a/lightning-block-sync/src/rpc.rs b/lightning-block-sync/src/rpc.rs index 6b4397a6..e1dc43c8 100644 --- a/lightning-block-sync/src/rpc.rs +++ b/lightning-block-sync/src/rpc.rs @@ -35,6 +35,9 @@ impl fmt::Display for RpcError { impl Error for RpcError {} /// A simple RPC client for calling methods using HTTP `POST`. +/// +/// Implements [`BlockSource`] and may return an `Err` containing [`RpcError`]. See +/// [`RpcClient::call_method`] for details. pub struct RpcClient { basic_auth: String, endpoint: HttpEndpoint, @@ -57,6 +60,9 @@ impl RpcClient { } /// Calls a method with the response encoded in JSON format and interpreted as type `T`. + /// + /// When an `Err` is returned, [`std::io::Error::into_inner`] may contain an [`RpcError`] if + /// [`std::io::Error::kind`] is [`std::io::ErrorKind::Other`]. pub async fn call_method(&self, method: &str, params: &[serde_json::Value]) -> std::io::Result where JsonResponse: TryFrom, Error = std::io::Error> + TryInto { let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port());