Scenario: running 2 Corda nodes (say, A and B) that are running within a larger zone. There is 1 notary node in the zone.
I have 2 different flows: the first flow f1
only runs on node A and only creates transactions that are stored locally (as in, no other nodes are involved). The second flow f2
also only runs on node A and creates a transaction that modifies the states inserted by flow f1
(s1, s2, ...
) by adding an input-output pair to the transaction where the input states are the existing (s1, s2, ...
) states and the output states are the modified states (s1', s2', ...
). Flow f2
also creates an additional output state, therefore we have Sn
input states and S(n+1
) output states. The transaction created in flow f2
is shared with node B.
Flow f1
runs fine, but as soon as I run flow f2
I receive the following error in Node A:
net.corda.core.flows.UnexpectedFlowEndException: net.corda.core.flows.NotaryFlow$Client is not registered
. In the logs of the notary I can see the same error, and when I check the logs for nodeB it says: net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored
I have local tests, using a mock network that is able to run fine. I currently have no clue on how to debug this issue or whether it is a mistake in the flow itself, or something else. I am running version 4.5.8
Below is the code snippet for creating the transaction in flow f2
(variables have been renamed):
val txBuilder = TransactionBuilder(notary)
.addOutputState(additionalState, CustomContract.ID)
.addCommand(
Command(
contract,
additionalState.participants.map { it.owningKey })
)
existingStates.forEach { txBuilder.addInputState(serviceHub.toStateAndRef<CustomState>(it.ref)) }
existingStatesModified.forEach { txBuilder.addOutputState(it, CustomContract.ID) }
// Stage 2.
progressTracker.currentStep = VERIFYING_TRANSACTION
// Verify that the transaction is valid.
txBuilder.verify(serviceHub)
// Stage 3.
progressTracker.currentStep = SIGNING_TRANSACTION
// Sign the transaction.
val partSignedTx = serviceHub.signInitialTransaction(txBuilder)
// Stage 4.
progressTracker.currentStep = GATHERING_SIGS
// Send the state to the counterparty, and receive it back with their signature.
val otherPartySessions = counterParties.map { initiateFlow(it!!) }
val fullySignedTx =
subFlow(CollectSignaturesFlow(partSignedTx, otherPartySessions, GATHERING_SIGS.childProgressTracker()))
// Stage 5.
progressTracker.currentStep = FINALISING_TRANSACTION
// Notarise and record the transaction in both parties' vaults.
require(insertEvent(insuranceEventState.fullEvent)) { "Unable to insert event data into the triple store." }
return subFlow(FinalityFlow(fullySignedTx, otherPartySessions, FINALISING_TRANSACTION.childProgressTracker()))```
Turns out this was caused by an incorrectly configured notary (which was out of my control).