Skip to content

Commit

Permalink
fix(serve): allow pparams query on origin ledger (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Dec 23, 2024
1 parent ab9eb1e commit 96e7c18
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/serve/grpc/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(),
}),
};

Expand Down

0 comments on commit 96e7c18

Please sign in to comment.