fix: state machine never reaching terminal state, causing reverts on confirmed and finalized XTXs
@@ -1344,6 +1344,21 @@ impl<T: Config> Pallet<T> {
},
// fixme: Separate for Bonded
CircuitStatus::Ready | CircuitStatus::PendingExecution | CircuitStatus::Finished => {
+ match new_status {
+ CircuitStatus::FinishedAllSteps => {
+ // todo: cleanup all of the local storage
+ // TODO cleanup sfx2xtx map
+ <Self as Store>::XExecSignals::mutate(local_ctx.xtx_id, |x| {
+ *x = Some(local_ctx.xtx.clone())
+ });
+
+ <Self as Store>::PendingXtxTimeoutsMap::remove(local_ctx.xtx_id);
+ (
+ Some(local_ctx.xtx.clone()),
+ Some(local_ctx.full_side_effects.clone()),
+ )
+ },
+ _ => {
// Update set of full side effects assuming the new confirmed has appeared
<Self as Store>::FullSideEffects::mutate(local_ctx.xtx_id, |x| {
*x = Some(local_ctx.full_side_effects.clone())
@@ -1361,6 +1376,8 @@ impl<T: Config> Pallet<T> {
(None, Some(local_ctx.full_side_effects.to_vec()))
}
},
+ }
+ },
CircuitStatus::FinishedAllSteps => {
// todo: cleanup all of the local storage
// TODO cleanup sfx2xtx map
