From a86c79e40ca15a8b95380608be81fe338d82b141 Mon Sep 17 00:00:00 2001 From: cxyzhang0 Date: Fri, 27 Jul 2018 02:09:14 -0700 Subject: [PATCH] CONTRIBUTION - IdentitySyncFlow - loadStates of an input only if it is in local storage (#3701) --- .../kotlin/net/corda/confidential/IdentitySyncFlow.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/confidential-identities/src/main/kotlin/net/corda/confidential/IdentitySyncFlow.kt b/confidential-identities/src/main/kotlin/net/corda/confidential/IdentitySyncFlow.kt index d27a5f6d18..84978dc45a 100644 --- a/confidential-identities/src/main/kotlin/net/corda/confidential/IdentitySyncFlow.kt +++ b/confidential-identities/src/main/kotlin/net/corda/confidential/IdentitySyncFlow.kt @@ -2,6 +2,7 @@ package net.corda.confidential import co.paralleluniverse.fibers.Suspendable import net.corda.core.contracts.ContractState +import net.corda.core.contracts.TransactionResolutionException import net.corda.core.flows.FlowLogic import net.corda.core.flows.FlowSession import net.corda.core.identity.AbstractParty @@ -53,7 +54,15 @@ object IdentitySyncFlow { } private fun extractOurConfidentialIdentities(): Map { - val states: List = (serviceHub.loadStates(tx.inputs.toSet()).map { it.state.data } + tx.outputs.map { it.data }) + val inputStates: List = (tx.inputs.toSet()).mapNotNull { + try { + serviceHub.loadState(it).data + } + catch (e: TransactionResolutionException) { + null + } + } + val states: List = inputStates + tx.outputs.map { it.data } val identities: Set = states.flatMap(ContractState::participants).toSet() // Filter participants down to the set of those not in the network map (are not well known) val confidentialIdentities = identities