Skip to content

Commit

Permalink
=Merge branch 'yuji/fix-proof-height' (#____)
Browse files Browse the repository at this point in the history
* origin/yuji/fix-proof-height:
  fix to get proofs even if no height is specified
  • Loading branch information
Gianmarco Fraccaroli committed Nov 20, 2023
2 parents f2e2dc5 + fe2d0af commit 0e4ffa5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/2166-fix-proof-height.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix to get the proof even if no height is specified
([\#2166](https://github.com/anoma/namada/issues/2166))
21 changes: 21 additions & 0 deletions core/src/ledger/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,13 @@ where
height: BlockHeight,
store_type: Option<StoreType>,
) -> Result<MerkleTree<H>> {
// `0` means last committed height
let height = if height == BlockHeight(0) {
self.get_last_block_height()
} else {
height
};

let epoch = self
.block
.pred_epochs
Expand Down Expand Up @@ -935,6 +942,13 @@ where
) -> Result<ProofOps> {
use std::array;

// `0` means last committed height
let height = if height == BlockHeight(0) {
self.get_last_block_height()
} else {
height
};

if height > self.get_last_block_height() {
if let MembershipProof::ICS23(proof) = self
.block
Expand Down Expand Up @@ -972,6 +986,13 @@ where
key: &Key,
height: BlockHeight,
) -> Result<ProofOps> {
// `0` means last committed height
let height = if height == BlockHeight(0) {
self.get_last_block_height()
} else {
height
};

if height > self.get_last_block_height() {
Err(Error::Temporary {
error: format!(
Expand Down

0 comments on commit 0e4ffa5

Please sign in to comment.