Skip to content

Commit 0763bf0

Browse files
authored
fix(cometbft-rpc): /status latest_{block,app}_hash is optional apparently (#4853)
2 parents 5de0de7 + 992161a commit 0763bf0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/cometbft-rpc/src/rpc_types.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ pub struct SyncInfo {
7272
#[serde(with = "::serde_utils::string")]
7373
pub earliest_block_height: u64,
7474
pub earliest_block_time: Timestamp,
75-
pub latest_app_hash: H256<HexUnprefixed>,
76-
pub latest_block_hash: H256<HexUnprefixed>,
75+
#[serde(with = "::cometbft_types::serde::maybe_empty_h256")]
76+
pub latest_app_hash: Option<H256<HexUnprefixed>>,
77+
#[serde(with = "::cometbft_types::serde::maybe_empty_h256")]
78+
pub latest_block_hash: Option<H256<HexUnprefixed>>,
7779
#[serde(with = "::serde_utils::string")]
7880
pub latest_block_height: u64,
7981
pub latest_block_time: Timestamp,

lib/cometbft-rpc/src/tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,16 @@ mod status {
399399
),
400400
earliest_block_height: 1,
401401
earliest_block_time: "2024-08-13T15:45:14.000000000Z".parse().unwrap(),
402-
latest_app_hash:
402+
latest_app_hash: Some(
403403
"5933c3aa776e3d9976694ed85f4d420db92d13025fac557f1334c9ff03696889"
404404
.parse()
405405
.unwrap(),
406-
latest_block_hash:
406+
),
407+
latest_block_hash: Some(
407408
"317cac7db536eaf1686b7a5319ce201530ee27a15b902679dac7adcd9633cc80"
408409
.parse()
409410
.unwrap(),
411+
),
410412
latest_block_height: 290884,
411413
latest_block_time: "2025-05-12T02:32:24.240017347Z".parse().unwrap(),
412414
},

0 commit comments

Comments
 (0)