Skip to content

Commit a101d20

Browse files
committed
Add warining message when using old confidential identities
1 parent 6994d07 commit a101d20

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

workflows/src/main/kotlin/com/r3/corda/lib/tokens/workflows/internal/flows/FlowVersionUtilities.kt

+8-20
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@ internal const val INITIATING_TOKENS_FLOW = "com.r3.corda.lib.tokens.workflows.f
3434
@Suspendable
3535
internal fun FlowLogic<*>.provideKeyVersion(session: FlowSession): AbstractParty {
3636
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
37-
val topLevelName = FlowLogic.currentTopLevel?.let { it::class.java.canonicalName } ?: ""
3837
// This will work only for initiating flow
3938
return if (otherFlowVersion == 1) {
40-
if (!topLevelName.startsWith(INITIATING_TOKENS_FLOW)) {
41-
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
42-
"If this is not intended behaviour version your flows with version >= 2")
43-
}
39+
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
40+
"If this is not intended behaviour version your flows with version >= 2")
4441
// Old Confidential Identities case
4542
subFlow(RequestConfidentialIdentityFlowHandler(session))
4643
} else {
@@ -52,13 +49,10 @@ internal fun FlowLogic<*>.provideKeyVersion(session: FlowSession): AbstractParty
5249
@Suspendable
5350
internal fun FlowLogic<*>.requestKeyVersion(session: FlowSession): AnonymousParty {
5451
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
55-
val topLevelName = FlowLogic.currentTopLevel?.let { it::class.java.canonicalName } ?: ""
5652
// This will work only for initiating flow
5753
return if (otherFlowVersion == 1) {
58-
if (!topLevelName.startsWith(INITIATING_TOKENS_FLOW)) {
59-
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
60-
"If this is not intended behaviour version your flows with version >= 2")
61-
}
54+
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
55+
"If this is not intended behaviour version your flows with version >= 2")
6256
// Old Confidential Identities case
6357
val key = subFlow(RequestConfidentialIdentityFlow(session)).owningKey
6458
AnonymousParty(key)
@@ -71,13 +65,10 @@ internal fun FlowLogic<*>.requestKeyVersion(session: FlowSession): AnonymousPart
7165
@Suspendable
7266
internal fun FlowLogic<*>.syncKeyVersionHandler(session: FlowSession) {
7367
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
74-
val topLevelName = FlowLogic.currentTopLevel?.let { it::class.java.canonicalName } ?: ""
7568
// This will work only for initiating flow
7669
if (otherFlowVersion == 1) {
77-
if (!topLevelName.startsWith(INITIATING_TOKENS_FLOW)) {
78-
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
79-
"If this is not intended behaviour version your flows with version >= 2")
80-
}
70+
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
71+
"If this is not intended behaviour version your flows with version >= 2")
8172
// Old Confidential Identities case
8273
subFlow(IdentitySyncFlow.Receive(session))
8374
} else {
@@ -89,13 +80,10 @@ internal fun FlowLogic<*>.syncKeyVersionHandler(session: FlowSession) {
8980
@Suspendable
9081
internal fun FlowLogic<*>.syncKeyVersion(session: FlowSession, txBuilder: TransactionBuilder) {
9182
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
92-
val topLevelName = FlowLogic.currentTopLevel?.let { it::class.java.canonicalName } ?: ""
9383
// This will work only for initiating flow
9484
if (otherFlowVersion == 1) {
95-
if (!topLevelName.startsWith(INITIATING_TOKENS_FLOW)) {
96-
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
97-
"If this is not intended behaviour version your flows with version >= 2")
98-
}
85+
logger.warn("Your CorDapp is using new confidential identities, but other party flow has version 1. Falling back to old CI." +
86+
"If this is not intended behaviour version your flows with version >= 2")
9987
// Old Confidential Identities case
10088
subFlow(IdentitySyncFlow.Send(session, txBuilder.toWireTransaction(serviceHub)))
10189
} else {

0 commit comments

Comments
 (0)