mirror of
https://github.com/corda/corda.git
synced 2025-06-20 08:03:53 +00:00
CONTRIBUTION - IdentitySyncFlow - loadStates of an input only if it is in local storage (#3701)
This commit is contained in:
@ -2,6 +2,7 @@ package net.corda.confidential
|
|||||||
|
|
||||||
import co.paralleluniverse.fibers.Suspendable
|
import co.paralleluniverse.fibers.Suspendable
|
||||||
import net.corda.core.contracts.ContractState
|
import net.corda.core.contracts.ContractState
|
||||||
|
import net.corda.core.contracts.TransactionResolutionException
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
import net.corda.core.flows.FlowSession
|
import net.corda.core.flows.FlowSession
|
||||||
import net.corda.core.identity.AbstractParty
|
import net.corda.core.identity.AbstractParty
|
||||||
@ -53,7 +54,15 @@ object IdentitySyncFlow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun extractOurConfidentialIdentities(): Map<AbstractParty, PartyAndCertificate?> {
|
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()
|
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)
|
// Filter participants down to the set of those not in the network map (are not well known)
|
||||||
val confidentialIdentities = identities
|
val confidentialIdentities = identities
|
||||||
|
Reference in New Issue
Block a user