diff --git a/src/persistence/stash.rs b/src/persistence/stash.rs index 0382da53..bb27478a 100644 --- a/src/persistence/stash.rs +++ b/src/persistence/stash.rs @@ -592,9 +592,14 @@ impl Stash

{ &mut self, seal: XChain, ) -> Result> { - self.provider + self.begin_transaction()?; + let seal = self + .provider .add_secret_seal(seal) - .map_err(StashError::WriteProvider) + .inspect_err(|_| self.rollback_transaction()) + .map_err(StashError::WriteProvider)?; + self.commit_transaction()?; + Ok(seal) } }