Reputation: 841
I'm working on a use case where there are three party involved, let's say PartyA, PartyB and PartyC.
In this scenario,
PartyA issue a dealState (A is the only participant),
PartyA sells it to PartyB (A,B are the participants),
now PartyB wants to sell this state to PartyC but we need the signatures from both A and B, plus the one from C accepting the selling process.
How can I gather the signature from the original issuer PartyA in the third scenario in order to make the flow work?
The code in the flow is this one (Im selling as PartyB)
val newOwnerFlow = initiateFlow(PartyC)
progressTracker.currentStep = GATHERING_SIGS
println("Finished gathering signatures stage 9")
// Send the state to the counterparty, and receive it back with their signature.
val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx, setOf(newOwnerFlow), GATHERING_SIGS.childProgressTracker()))
// Stage 10.
progressTracker.currentStep = FINALISING_TRANSACTION
println("Finalizing transaction")
// Notarise and record the transaction in both parties' vaults.
return subFlow(FinalityFlow(fullySignedTx, FINALISING_TRANSACTION.childProgressTracker()))
How do I make PartyA signing the transaction?
Upvotes: 1
Views: 623
Reputation: 841
After some experimenting I found out the problem is the following:
you have to create a setOf(flowSessions) mapping each participant to its correspondent initiateFlow() that has to be passed to the CollectSignaturesFlow(), the syntax is like the following:
val participantsParties = dealState.participants.map { serviceHub.identityService.wellKnownPartyFromAnonymous(it)!! }
val flowSessions = (participantsParties - myIdentity).map { initiateFlow(it) }.toSet()
progressTracker.currentStep = GATHERING_SIGS
println("Finished gathering signatures stage 9")
// Send the state to the counterparty, and receive it back with their signature.
val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx, flowSessions, GATHERING_SIGS.childProgressTracker()))
Upvotes: 1