mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(DbTx): add get_by_encoded_key (#13171)
This commit is contained in:
@ -219,9 +219,12 @@ impl Account {
|
||||
///
|
||||
/// In case of a mismatch, `Err(Error::Assertion)` is returned.
|
||||
pub fn assert_db(&self, address: Address, tx: &impl DbTx) -> Result<(), Error> {
|
||||
let account = tx.get::<tables::PlainAccountState>(address)?.ok_or_else(|| {
|
||||
Error::Assertion(format!("Expected account ({address}) is missing from DB: {self:?}"))
|
||||
})?;
|
||||
let account =
|
||||
tx.get_by_encoded_key::<tables::PlainAccountState>(&address)?.ok_or_else(|| {
|
||||
Error::Assertion(format!(
|
||||
"Expected account ({address}) is missing from DB: {self:?}"
|
||||
))
|
||||
})?;
|
||||
|
||||
assert_equal(self.balance, account.balance, "Balance does not match")?;
|
||||
assert_equal(self.nonce.to(), account.nonce, "Nonce does not match")?;
|
||||
|
||||
Reference in New Issue
Block a user