From 96e7c1833e56e6bd3b8ee34697fa2af6e32de904 Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Mon, 23 Dec 2024 18:41:54 -0300 Subject: [PATCH] fix(serve): allow pparams query on origin ledger (#416) --- src/serve/grpc/query.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/serve/grpc/query.rs b/src/serve/grpc/query.rs index 5ef45b9..35a5c62 100644 --- a/src/serve/grpc/query.rs +++ b/src/serve/grpc/query.rs @@ -225,12 +225,11 @@ impl u5c::query::query_service_server::QueryService for QueryServiceImpl { info!("received new grpc query"); - let curr_point = match self.ledger.cursor()? { - Some(point) => point, - None => return Err(Status::internal("Uninitialized ledger.")), - }; + let tip = self.ledger.cursor()?; - let updates: Vec<_> = self.ledger.get_pparams(curr_point.0)?; + let updates: Vec<_> = self + .ledger + .get_pparams(tip.as_ref().map(|p| p.0).unwrap_or_default())?; let updates: Vec<_> = updates .iter() @@ -247,9 +246,9 @@ impl u5c::query::query_service_server::QueryService for QueryServiceImpl { ) .into(), }), - ledger_tip: Some(u5c::query::ChainPoint { - slot: curr_point.0, - hash: curr_point.1.to_vec().into(), + ledger_tip: tip.map(|p| u5c::query::ChainPoint { + slot: p.0, + hash: p.1.to_vec().into(), }), };