mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
Remove Backend::destroy_state (#5068)
* Remove `Backend::destroy_state` This removes the `destroy_state` function of `Backend` and instead moves the functionality into the `Drop` implementation of the state. This makes it much easier to work with the state, as the user no longer needs to call` destroy_state` manually. However, it requires that we switch from `RwLock` to `ReentrantMutex` as while importing a block we maybe need to lock again in `drop`. * Bring back the `RwLock` and some other clean ups * Fix compilation
This commit is contained in:
@@ -420,11 +420,6 @@ pub trait Backend<Block: BlockT>: AuxStore + Send + Sync {
|
||||
/// Returns state backend with post-state of given block.
|
||||
fn state_at(&self, block: BlockId<Block>) -> sp_blockchain::Result<Self::State>;
|
||||
|
||||
/// Destroy state and save any useful data, such as cache.
|
||||
fn destroy_state(&self, _state: Self::State) -> sp_blockchain::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Attempts to revert the chain by `n` blocks. If `revert_finalized` is set
|
||||
/// it will attempt to revert past any finalized block, this is unsafe and
|
||||
/// can potentially leave the node in an inconsistent state.
|
||||
|
||||
Reference in New Issue
Block a user