chore: dont get plain state if not shard is there (#2959)

This commit is contained in:
rakita
2023-06-02 14:50:19 +02:00
committed by GitHub
parent a03c380d1a
commit a2287c68a6

View File

@ -64,6 +64,9 @@ impl<'a, 'b, TX: DbTx<'a>> AccountProvider for HistoricalStateProviderRef<'a, 'b
address,
})?;
Ok(account.info)
} else if None == changeset_block_number {
// if there is no shard, return empty account.
Ok(None)
} else {
// if changeset is not present that means that there was history shard but we need to
// use newest value from plain state. Or zero if none.
@ -126,6 +129,9 @@ impl<'a, 'b, TX: DbTx<'a>> StateProvider for HistoricalStateProviderRef<'a, 'b,
storage_key,
})?;
Ok(Some(storage_entry.value))
} else if changeset_block_number == None {
// if there is no shards, return empty account.
return Ok(None);
} else {
// if changeset is not present that means that there was history shard but we need to
// use newest value from plain state