From 337f663c75636158fe3ed34b9793e6dd6d5205b8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 27 Sep 2023 15:51:10 +0200 Subject: [PATCH] fix: use callback + remember to clean up --- state-chain/runtime/src/lib.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/state-chain/runtime/src/lib.rs b/state-chain/runtime/src/lib.rs index f7a91702fb..d68bb564ee 100644 --- a/state-chain/runtime/src/lib.rs +++ b/state-chain/runtime/src/lib.rs @@ -833,7 +833,7 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomUpgrade { let mut nonce = 1; // transfers first - for (_id, (ref mut api_call, _signature)) in api_calls.iter_mut() { + for (id, (ref mut api_call, _signature)) in api_calls.iter_mut() { match api_call { cf_chains::dot::api::PolkadotApi::BatchFetchAndTransfer(ref mut ext_builder) => { ext_builder.force_nonce(nonce); @@ -841,7 +841,11 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomUpgrade { _ => continue, } nonce += 1; - PolkadotBroadcaster::threshold_sign_and_broadcast(api_call.clone(), None); + PolkadotBroadcaster::threshold_sign_and_broadcast( + api_call.clone(), + pallet_cf_broadcast::RequestCallbacks::::get(id), + ); + PolkadotBroadcaster::clean_up_broadcast_storage(id); } // then the rotation for (_id, (ref mut api_call, _signature)) in api_calls.iter_mut() { @@ -852,7 +856,11 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomUpgrade { _ => continue, } nonce += 1; - PolkadotBroadcaster::threshold_sign_and_broadcast(api_call.clone(), None); + PolkadotBroadcaster::threshold_sign_and_broadcast( + api_call.clone(), + pallet_cf_broadcast::RequestCallbacks::::get(id), + ); + PolkadotBroadcaster::clean_up_broadcast_storage(id); } Weight::zero()