Skip to content

Commit f48e273

Browse files
committed
Expose RpcClient and RestClient interfaces as pub
Useful for use outside of the BlockSource context, e.g., when implementing fee estimation or transaction broadcasting.
1 parent 4894d52 commit f48e273

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lightning-block-sync/src/http.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ enum HttpMessageLength {
399399
}
400400

401401
/// An HTTP response body in binary format.
402-
pub(crate) struct BinaryResponse(pub(crate) Vec<u8>);
402+
pub struct BinaryResponse(pub Vec<u8>);
403403

404404
/// An HTTP response body in JSON format.
405-
pub(crate) struct JsonResponse(pub(crate) serde_json::Value);
405+
pub struct JsonResponse(pub serde_json::Value);
406406

407407
/// Interprets bytes from an HTTP response body as binary data.
408408
impl TryFrom<Vec<u8>> for BinaryResponse {

lightning-block-sync/src/rest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl RestClient {
2424
}
2525

2626
/// Requests a resource encoded in `F` format and interpreted as type `T`.
27-
async fn request_resource<F, T>(&mut self, resource_path: &str) -> std::io::Result<T>
27+
pub async fn request_resource<F, T>(&mut self, resource_path: &str) -> std::io::Result<T>
2828
where F: TryFrom<Vec<u8>, Error = std::io::Error> + TryInto<T, Error = std::io::Error> {
2929
let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port());
3030
let uri = format!("{}/{}", self.endpoint.path().trim_end_matches("/"), resource_path);

lightning-block-sync/src/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl RpcClient {
3434
}
3535

3636
/// Calls a method with the response encoded in JSON format and interpreted as type `T`.
37-
async fn call_method<T>(&mut self, method: &str, params: &[serde_json::Value]) -> std::io::Result<T>
37+
pub async fn call_method<T>(&mut self, method: &str, params: &[serde_json::Value]) -> std::io::Result<T>
3838
where JsonResponse: TryFrom<Vec<u8>, Error = std::io::Error> + TryInto<T, Error = std::io::Error> {
3939
let host = format!("{}:{}", self.endpoint.host(), self.endpoint.port());
4040
let uri = self.endpoint.path();

0 commit comments

Comments
 (0)