From 1da1c99f44c47483bb2adcb9dc34e58ec059df94 Mon Sep 17 00:00:00 2001 From: Mikhail Zabaluev Date: Fri, 14 Jul 2023 16:10:00 +0300 Subject: [PATCH] rpc: use compat mode in latest_block_results() (#1326) Just like with the block_results method, the response needs to be parsed varyingly with the RPC dialect. --- .../bug-fixes/1326-compat-for-latest_block_results.md | 3 +++ rpc/src/client/transport/http.rs | 4 ++++ rpc/src/client/transport/websocket.rs | 4 ++++ 3 files changed, 11 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/1326-compat-for-latest_block_results.md diff --git a/.changelog/unreleased/bug-fixes/1326-compat-for-latest_block_results.md b/.changelog/unreleased/bug-fixes/1326-compat-for-latest_block_results.md new file mode 100644 index 000000000..804ba45b8 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1326-compat-for-latest_block_results.md @@ -0,0 +1,3 @@ +- [tendermint-rpc]` Use compatibility mode in implementations + of the `Client::latest_block_results` method + ([\#1326](https://github.com/informalsystems/tendermint-rs/pull/1326)) diff --git a/rpc/src/client/transport/http.rs b/rpc/src/client/transport/http.rs index 2c89d4163..ceaa427cd 100644 --- a/rpc/src/client/transport/http.rs +++ b/rpc/src/client/transport/http.rs @@ -181,6 +181,10 @@ impl Client for HttpClient { perform_with_compat!(self, endpoint::block_results::Request::new(height.into())) } + async fn latest_block_results(&self) -> Result { + perform_with_compat!(self, endpoint::block_results::Request::default()) + } + async fn header(&self, height: H) -> Result where H: Into + Send, diff --git a/rpc/src/client/transport/websocket.rs b/rpc/src/client/transport/websocket.rs index 0c1a710e6..c28ab14f7 100644 --- a/rpc/src/client/transport/websocket.rs +++ b/rpc/src/client/transport/websocket.rs @@ -244,6 +244,10 @@ impl Client for WebSocketClient { perform_with_compat!(self, endpoint::block_results::Request::new(height.into())) } + async fn latest_block_results(&self) -> Result { + perform_with_compat!(self, endpoint::block_results::Request::default()) + } + async fn header(&self, height: H) -> Result where H: Into + Send,