mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 19:11:05 +00:00
Handle local storage race conditions better (#3177)
* Make local_storage_compare_and_set take Option for old_value * Adapt srml/im-online to API changes * Bump version * Bump version again * Replace match
This commit is contained in:
committed by
Gavin Wood
parent
af914e9f40
commit
23fba990ba
@@ -209,14 +209,14 @@ impl offchain::Externalities for TestOffchainExt {
|
||||
&mut self,
|
||||
kind: StorageKind,
|
||||
key: &[u8],
|
||||
old_value: &[u8],
|
||||
old_value: Option<&[u8]>,
|
||||
new_value: &[u8]
|
||||
) -> bool {
|
||||
let mut state = self.0.write();
|
||||
match kind {
|
||||
StorageKind::LOCAL => &mut state.local_storage,
|
||||
StorageKind::PERSISTENT => &mut state.persistent_storage,
|
||||
}.compare_and_set(b"", key, Some(old_value), new_value)
|
||||
}.compare_and_set(b"", key, old_value, new_value)
|
||||
}
|
||||
|
||||
fn local_storage_get(&mut self, kind: StorageKind, key: &[u8]) -> Option<Vec<u8>> {
|
||||
|
||||
Reference in New Issue
Block a user