Skip to content

Commit

Permalink
Merge remote-tracking branch 'namada/james/mainline/fix-require-lates…
Browse files Browse the repository at this point in the history
…t-height' (#752) into main

* namada/james/mainline/fix-require-latest-height:
  Add changelog
  fix: require_latest_height check should skip for requests with height 0
  • Loading branch information
juped committed Nov 14, 2022
2 parents 313eaf3 + 86ac4d2 commit 1e4dd41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- require_latest_height should skip requests with height 0
([#752](https://github.com/anoma/namada/pull/752))
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 1e4dd41

Please sign in to comment.