Skip to content

Commit

Permalink
fix: require_latest_height check should skip for requests with height 0
Browse files Browse the repository at this point in the history
  • Loading branch information
james-chf committed Nov 7, 2022
1 parent 6cbce4a commit df84dee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shared/src/ledger/queries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub use types::{

use super::storage::{DBIter, StorageHasher, DB};
use super::storage_api;
use crate::types::storage::BlockHeight;

#[macro_use]
mod router;
Expand Down Expand Up @@ -47,7 +48,9 @@ where
D: 'static + DB + for<'iter> DBIter<'iter> + Sync,
H: 'static + StorageHasher + Sync,
{
if request.height != ctx.storage.last_height {
if request.height != BlockHeight(0)
&& request.height != ctx.storage.last_height
{
return Err(storage_api::Error::new_const(
"This query doesn't support arbitrary block heights, only the \
latest committed block height ('0' can be used as a special \
Expand Down

0 comments on commit df84dee

Please sign in to comment.