diff --git a/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt b/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt index b61aa7e51f..a98daaf9d9 100644 --- a/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt +++ b/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt @@ -354,6 +354,10 @@ class SingleThreadedStateMachineManager( null } externalEventMutex.withLock { + // Remove any sessions the old flow has. + for (sessionId in getFlowSessionIds(currentState.checkpoint)) { + sessionToFlow.remove(sessionId) + } if (flow != null) addAndStartFlow(flowId, flow) // Deliver all the external events from the old flow instance. val unprocessedExternalEvents = mutableListOf()