IdentitySyncFlow - loadStates of an input only if it is in local storage (#3701)

This commit is contained in:
cxyzhang0 2018-07-27 02:09:14 -07:00 committed by Shams Asari
parent 4075e29120
commit c8de5ce08d

View File

@ -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<AbstractParty, PartyAndCertificate?> {
val states: List<ContractState> = (serviceHub.loadStates(tx.inputs.toSet()).map { it.state.data } + tx.outputs.map { it.data })
val inputStates: List<ContractState> = (tx.inputs.toSet()).mapNotNull {
try {
serviceHub.loadState(it).data
}
catch (e: TransactionResolutionException) {
null
}
}
val states: List<ContractState> = inputStates + tx.outputs.map { it.data }
val identities: Set<AbstractParty> = 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