]> Untitled Git - bdk/commit
Fix and improve `Persist::commit` method
author志宇 <hello@evanlinjin.me>
Thu, 11 May 2023 03:49:33 +0000 (11:49 +0800)
committer志宇 <hello@evanlinjin.me>
Thu, 11 May 2023 03:49:33 +0000 (11:49 +0800)
commit96b10751325dc1bced09f9e864438216400e4ba3
tree2f98a7fce301f633cbcb0e2a826820905e7831c9
parente01d17d59bd6177bf5e457232219669782b727b7
Fix and improve `Persist::commit` method

Previously, regardless of whether writing to persistence backend is
successful or not, the logic always cleared `self.staged`. This is
changed to only clear `self.staged` after successful write.

Additionally, the written changeset (if any) is returned, and
`PersistBackend::write_changes` will not be called if `self.staged` is
empty.
crates/chain/src/persist.rs