gears
gears copied to clipboard
[BUG]: Delete method on KVStore is broken
Is there an existing issue for this?
- [X] I have searched the existing issues
What happened?
The delete implementation on the KVStore
is:
pub fn delete(&mut self, k: &[u8]) -> Option<Vec<u8>> {
let tx_value = self.tx_cache.remove(k);
let block_value = self.block_cache.remove(k);
let persisted_value = self.persistent_store.remove(k);
tx_value.or(block_value).or(persisted_value)
}
This deletes from the block cache and persisted store even if the Tx fails. The block cache and persisted store should only be written to when write_then_clear_tx_cache
is called.
Gears version
main
Steps to reproduce?
No response