@@ -30,15 +30,22 @@ import java.security.SignatureException
30
30
*/
31
31
internal const val INITIATING_TOKENS_FLOW = " com.r3.corda.lib.tokens.workflows.flows.rpc."
32
32
33
+ @Suspendable
34
+ internal fun FlowLogic <* >.counterpartyPlatformVersion (session : FlowSession ): Int {
35
+ val nodeInfo = serviceHub.networkMapCache.getNodeByLegalIdentity(session.counterparty)
36
+ return nodeInfo?.platformVersion ? : 0
37
+ }
38
+
33
39
// Internal utilities after introducing new confidential identities. To handle different versions.
34
40
@Suspendable
35
41
internal fun FlowLogic <* >.provideKeyVersion (session : FlowSession ): AbstractParty {
36
42
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
37
43
val topLevelName = FlowLogic .currentTopLevel?.let { it::class .java.canonicalName } ? : " "
38
44
// This will work only for initiating flow
39
- return if (otherFlowVersion == 1 ) {
45
+ return if (otherFlowVersion == 1 || counterpartyPlatformVersion(session) < 5 ) {
40
46
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." +
47
+ logger.warn(" Your CorDapp is using new confidential identities, but other party flow has version 1 or runs " +
48
+ " on platformVersion less than 5. Falling back to old CI." +
42
49
" If this is not intended behaviour version your flows with version >= 2" )
43
50
}
44
51
// Old Confidential Identities case
@@ -54,9 +61,10 @@ internal fun FlowLogic<*>.requestKeyVersion(session: FlowSession): AnonymousPart
54
61
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
55
62
val topLevelName = FlowLogic .currentTopLevel?.let { it::class .java.canonicalName } ? : " "
56
63
// This will work only for initiating flow
57
- return if (otherFlowVersion == 1 ) {
64
+ return if (otherFlowVersion == 1 || counterpartyPlatformVersion(session) < 5 ) {
58
65
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." +
66
+ logger.warn(" Your CorDapp is using new confidential identities, but other party flow has version 1 or runs " +
67
+ " on platformVersion less than 5. Falling back to old CI." +
60
68
" If this is not intended behaviour version your flows with version >= 2" )
61
69
}
62
70
// Old Confidential Identities case
@@ -73,9 +81,10 @@ internal fun FlowLogic<*>.syncKeyVersionHandler(session: FlowSession) {
73
81
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
74
82
val topLevelName = FlowLogic .currentTopLevel?.let { it::class .java.canonicalName } ? : " "
75
83
// This will work only for initiating flow
76
- if (otherFlowVersion == 1 ) {
84
+ if (otherFlowVersion == 1 || counterpartyPlatformVersion(session) < 5 ) {
77
85
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." +
86
+ logger.warn(" Your CorDapp is using new confidential identities, but other party flow has version 1 or runs " +
87
+ " on platformVersion less than 5. Falling back to old CI." +
79
88
" If this is not intended behaviour version your flows with version >= 2" )
80
89
}
81
90
// Old Confidential Identities case
@@ -91,9 +100,10 @@ internal fun FlowLogic<*>.syncKeyVersion(session: FlowSession, txBuilder: Transa
91
100
val otherFlowVersion = session.getCounterpartyFlowInfo().flowVersion
92
101
val topLevelName = FlowLogic .currentTopLevel?.let { it::class .java.canonicalName } ? : " "
93
102
// This will work only for initiating flow
94
- if (otherFlowVersion == 1 ) {
103
+ if (otherFlowVersion == 1 && counterpartyPlatformVersion(session) < 5 ) {
95
104
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." +
105
+ logger.warn(" Your CorDapp is using new confidential identities, but other party flow has version 1 and runs " +
106
+ " on platformVersion less than 5. Falling back to old CI." +
97
107
" If this is not intended behaviour version your flows with version >= 2" )
98
108
}
99
109
// Old Confidential Identities case
0 commit comments