Apply suggestions from code review

Co-authored-by: str4d <thestr4d@gmail.com>
This commit is contained in:
Kris Nuttycombe 2023-09-11 17:04:49 -06:00 committed by Kris Nuttycombe
parent 24e8c82546
commit f2dcba3a34
3 changed files with 5 additions and 2 deletions

View File

@ -1197,7 +1197,7 @@ pub mod testing {
&self,
min_confirmations: NonZeroU32,
) -> Result<usize, ShardTreeError<Self::Error>> {
Ok(usize::try_from(u32::from(min_confirmations) - 1).unwrap())
Ok(usize::try_from(u32::from(min_confirmations)).unwrap())
}
}
}

View File

@ -805,6 +805,9 @@ impl<P: consensus::Parameters> WalletCommitmentTrees for WalletDb<rusqlite::Conn
) -> Result<usize, ShardTreeError<Self::Error>> {
get_checkpoint_depth(&self.conn, SAPLING_TABLES_PREFIX, min_confirmations)
.map_err(|e| ShardTreeError::Storage(commitment_tree::Error::Query(e)))?
// `CheckpointPruned` is perhaps a little misleading; in this case it's that
// the chain tip is unknown, but if that were the case we should never have been
// calling this anyway.
.ok_or(ShardTreeError::Query(QueryError::CheckpointPruned))
}
}

View File

@ -1315,7 +1315,7 @@ pub(crate) mod tests {
let (account, usk, birthday) = st.test_account().unwrap();
let dfvk = st.test_account_sapling().unwrap();
// Generate a block that with funds belonging to our wallet.
// Generate a block with funds belonging to our wallet.
st.generate_next_block(
&dfvk,
AddressType::DefaultExternal,