From dcaf5805fd54bbc9b494b62047c18a866cefd600 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Tue, 13 Dec 2022 16:53:59 +0000 Subject: [PATCH] Revert "frame/remote-externalities: Eliminate side effect on batch request failure" This reverts commit 3678529c10234b611d25b16879ae614cd801b555. --- utils/frame/remote-externalities/src/lib.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/utils/frame/remote-externalities/src/lib.rs b/utils/frame/remote-externalities/src/lib.rs index 20ee7e7a16577..12253afe09c19 100644 --- a/utils/frame/remote-externalities/src/lib.rs +++ b/utils/frame/remote-externalities/src/lib.rs @@ -516,8 +516,6 @@ where // `pending_ext`. let mut terminated = 0usize; let mut batch_failed = false; - let mut batch_kv = Vec::with_capacity(keys.len()); - loop { match rx.next().await.unwrap() { Message::Batch(kv) => { @@ -526,7 +524,7 @@ where if is_default_child_storage_key(k.as_ref()) { continue } - batch_kv.push((k, v)); + pending_ext.insert(k, v); } }, Message::BatchFailed(error) => { @@ -551,11 +549,6 @@ where return Err("Batch failed.") } - // Ensure that `pending_ext` is populated only if the batch succeeded. - for (k, v) in batch_kv.into_iter() { - pending_ext.insert(k, v); - } - Ok(keys_and_values) }