diff --git a/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt b/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt index d2813f9e1e..4bc0917347 100644 --- a/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt +++ b/confidential-identities/src/main/kotlin/net/corda/confidential/SwapIdentitiesFlow.kt @@ -90,10 +90,12 @@ private constructor(private val otherSideSession: FlowSession?, @Suspendable override fun call(): LinkedHashMap { - val session = otherSideSession ?: run { + val session = if (otherParty != null && otherParty != otherSideSession?.counterparty) { logger.warnOnce("The current usage of SwapIdentitiesFlow is unsafe. Please consider upgrading your CorDapp to use " + "SwapIdentitiesFlow with FlowSessions. (${CordappResolver.currentCordapp?.info})") - initiateFlow(otherParty!!) + initiateFlow(otherParty) + } else { + otherSideSession!! } progressTracker.currentStep = GENERATING_IDENTITY val ourAnonymousIdentity = serviceHub.keyManagementService.freshKeyAndCert(ourIdentityAndCert, false)