Account Based Implementation Queries


archita.dasgupta@...
 

Hi Team,

 

We have a requirement to send states from an account to multiple accounts in a single transaction. These recipient accounts can reside in same node or may be in different nodes.

Right now we are able to send states from one account to another single account residing in same node. Also, in a separate transaction we are able to send to another account residing in different node. Sample codes are attached(SendInvoice.java, SendInternalInvoice.java).

 

Now we want to combine these 2 in a single transaction.

 

For these we have followed below steps. Code has been attached (SendInvoiceToMult.java) :-

 

Step 1: We are locally signing the transaction with sender’s key –

final SignedTransaction locallySignedTx = getServiceHub().signInitialTransaction(txBuilder, Lists.newArrayList(getOurIdentity().getOwningKey(), myKey.getOwningKey()));

 

Step 2: Then we are collecting signature for different node’s account –

FlowSession sessionForAccountToSendToDN = initiateFlow(targetAccountDN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureDN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

 

Step 3: Then we are collecting signature for same node’s account –

FlowSession sessionForAccountToSendToSN = initiateFlow(targetAccountSN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureSN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToSN, targetAcctAnonymousPartySN.getOwningKey()));

 

Step 4: Then we are combining these 2 signatures and calling the finality flow :-

List<TransactionSignature> allSignature = new ArrayList<>();
allSignature.addAll(accountToMoveToSignatureDN);
allSignature.addAll(accountToMoveToSignatureSN);
SignedTransaction signedByAllCounterParty = locallySignedTx.withAdditionalSignatures(allSignature);

Set<FlowSession> counterPartySessions = new HashSet<>();
counterPartySessions.add(sessionForAccountToSendToSN);
counterPartySessions.add(sessionForAccountToSendToDN);

SignedTransaction partSignedTx = subFlow(
       
new CollectSignaturesFlow(signedByAllCounterParty, counterPartySessions));
// Stage 5.
progressTracker.setCurrentStep(FINALISING_TRANSACTION);
// Notarise and record the transaction in both parties' vaults.

SignedTransaction fullySignedTx =  subFlow(new FinalityFlow(partSignedTx, Lists.newArrayList(sessionForAccountToSendToSN,sessionForAccountToSendToDN)));

 

Error:

With the above implementation we are getting above error :-

 

[WARN ] 2020-01-22T08:08:48,112Z [flow-worker] interceptors.DumpHistoryOnErrorInterceptor. - Flow [57b61e86-63f5-4a02-99b6-78cc9f4ad83f] error [errorCode=fnyzaf, moreInformationAt=https://errors.corda.net/ENT/4.3/fnyzaf] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000016, flow-id=57b61e86-63f5-4a02-99b6-78cc9f4ad83f, invocation_id=a529ce19-b5f0-433a-a47d-d8e300d1090e, invocation_timestamp=2020-01-22T08:08:47.634Z, origin=internalShell, session_id=9e4c4931-7706-48a3-803e-e7a37c7e34a2, session_timestamp=2020-01-20T10:23:01.826Z, thread-id=253}

net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored

     at Received unexpected counter-flow exception from peer O=PartyB, L=New York, C=US.() ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.fillInLocalStackTrace(FlowStateMachineImpl.kt:179) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.processEventsUntilFlowIsResumed(FlowStateMachineImpl.kt:167) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.suspend(FlowStateMachineImpl.kt:452) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:67) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:71) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:342) ~[corda-core-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:190) ~[corda-core-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:334) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:326) ~[corda-core-4.3.jar:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:145) ~[?:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:45) ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:274) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.3.jar:?]

     at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_231]

     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_231]

     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar:4.1.29.Final]

     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]

 

Please let us know whether we are missing anything. Also are there any different approach that we are missing. Please find the attached code snippets that are being used.

It would be great if we get any sample code that is aligned with these requirement.

 

Thanks in advance,

Archita Dasgupta


Stefano Franz
 

The error you are seeing is due to mismatched Send and Receives in the flows (UnexpectedFlowEndException. This specific error is not actually related to accounts at all. 

Could you tell us which side is that error present on? Is it during broacast or during finality? 

From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 09:44
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: [corda-dev] Account Based Implementation Queries
 

Hi Team,

 

We have a requirement to send states from an account to multiple accounts in a single transaction. These recipient accounts can reside in same node or may be in different nodes.

Right now we are able to send states from one account to another single account residing in same node. Also, in a separate transaction we are able to send to another account residing in different node. Sample codes are attached(SendInvoice.java, SendInternalInvoice.java).

 

Now we want to combine these 2 in a single transaction.

 

For these we have followed below steps. Code has been attached (SendInvoiceToMult.java) :-

 

Step 1: We are locally signing the transaction with sender’s key –

final SignedTransaction locallySignedTx = getServiceHub().signInitialTransaction(txBuilder, Lists.newArrayList(getOurIdentity().getOwningKey(), myKey.getOwningKey()));

 

Step 2: Then we are collecting signature for different node’s account –

FlowSession sessionForAccountToSendToDN = initiateFlow(targetAccountDN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureDN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

 

Step 3: Then we are collecting signature for same node’s account –

FlowSession sessionForAccountToSendToSN = initiateFlow(targetAccountSN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureSN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToSN, targetAcctAnonymousPartySN.getOwningKey()));

 

Step 4: Then we are combining these 2 signatures and calling the finality flow :-

List<TransactionSignature> allSignature = new ArrayList<>();
allSignature.addAll(accountToMoveToSignatureDN);
allSignature.addAll(accountToMoveToSignatureSN);
SignedTransaction signedByAllCounterParty = locallySignedTx.withAdditionalSignatures(allSignature);

Set<FlowSession> counterPartySessions = new HashSet<>();
counterPartySessions.add(sessionForAccountToSendToSN);
counterPartySessions.add(sessionForAccountToSendToDN);

SignedTransaction partSignedTx = subFlow(
       
new CollectSignaturesFlow(signedByAllCounterParty, counterPartySessions));
// Stage 5.
progressTracker.setCurrentStep(FINALISING_TRANSACTION);
// Notarise and record the transaction in both parties' vaults.

SignedTransaction fullySignedTx =  subFlow(new FinalityFlow(partSignedTx, Lists.newArrayList(sessionForAccountToSendToSN,sessionForAccountToSendToDN)));

 

Error:

With the above implementation we are getting above error :-

 

[WARN ] 2020-01-22T08:08:48,112Z [flow-worker] interceptors.DumpHistoryOnErrorInterceptor. - Flow [57b61e86-63f5-4a02-99b6-78cc9f4ad83f] error [errorCode=fnyzaf, moreInformationAt=https://errors.corda.net/ENT/4.3/fnyzaf] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000016, flow-id=57b61e86-63f5-4a02-99b6-78cc9f4ad83f, invocation_id=a529ce19-b5f0-433a-a47d-d8e300d1090e, invocation_timestamp=2020-01-22T08:08:47.634Z, origin=internalShell, session_id=9e4c4931-7706-48a3-803e-e7a37c7e34a2, session_timestamp=2020-01-20T10:23:01.826Z, thread-id=253}

net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored

     at Received unexpected counter-flow exception from peer O=PartyB, L=New York, C=US.() ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.fillInLocalStackTrace(FlowStateMachineImpl.kt:179) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.processEventsUntilFlowIsResumed(FlowStateMachineImpl.kt:167) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.suspend(FlowStateMachineImpl.kt:452) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:67) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:71) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:342) ~[corda-core-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:190) ~[corda-core-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:334) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:326) ~[corda-core-4.3.jar:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:145) ~[?:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:45) ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:274) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.3.jar:?]

     at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_231]

     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_231]

     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar:4.1.29.Final]

     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]

 

Please let us know whether we are missing anything. Also are there any different approach that we are missing. Please find the attached code snippets that are being used.

It would be great if we get any sample code that is aligned with these requirement.

 

Thanks in advance,

Archita Dasgupta


archita.dasgupta@...
 

Hi Team,

We are  getting these error while executing CollectSignatureFlow for different account in the below line :-

List<? extends TransactionSignature> accountToMoveToSignatureDN = subFlow(
                    new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

Please let me know if you need any more information.

Thanks & Regards,

Archita Dasgupta

BFS Blockchain , Kolkata

mailto:Archita.Dasgupta@...



From: corda-dev@groups.io <corda-dev@groups.io> on behalf of Stefano Franz via Groups.Io <Stefano.Franz@...>
Sent: 22 January 2020 17:48
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: Re: [corda-dev] Account Based Implementation Queries
 
[External]

The error you are seeing is due to mismatched Send and Receives in the flows (UnexpectedFlowEndException. This specific error is not actually related to accounts at all. 

Could you tell us which side is that error present on? Is it during broacast or during finality? 

From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 09:44
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: [corda-dev] Account Based Implementation Queries
 

Hi Team,

 

We have a requirement to send states from an account to multiple accounts in a single transaction. These recipient accounts can reside in same node or may be in different nodes.

Right now we are able to send states from one account to another single account residing in same node. Also, in a separate transaction we are able to send to another account residing in different node. Sample codes are attached(SendInvoice.java, SendInternalInvoice.java).

 

Now we want to combine these 2 in a single transaction.

 

For these we have followed below steps. Code has been attached (SendInvoiceToMult.java) :-

 

Step 1: We are locally signing the transaction with sender’s key –

final SignedTransaction locallySignedTx = getServiceHub().signInitialTransaction(txBuilder, Lists.newArrayList(getOurIdentity().getOwningKey(), myKey.getOwningKey()));

 

Step 2: Then we are collecting signature for different node’s account –

FlowSession sessionForAccountToSendToDN = initiateFlow(targetAccountDN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureDN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

 

Step 3: Then we are collecting signature for same node’s account –

FlowSession sessionForAccountToSendToSN = initiateFlow(targetAccountSN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureSN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToSN, targetAcctAnonymousPartySN.getOwningKey()));

 

Step 4: Then we are combining these 2 signatures and calling the finality flow :-

List<TransactionSignature> allSignature = new ArrayList<>();
allSignature.addAll(accountToMoveToSignatureDN);
allSignature.addAll(accountToMoveToSignatureSN);
SignedTransaction signedByAllCounterParty = locallySignedTx.withAdditionalSignatures(allSignature);

Set<FlowSession> counterPartySessions = new HashSet<>();
counterPartySessions.add(sessionForAccountToSendToSN);
counterPartySessions.add(sessionForAccountToSendToDN);

SignedTransaction partSignedTx = subFlow(
       
new CollectSignaturesFlow(signedByAllCounterParty, counterPartySessions));
// Stage 5.
progressTracker.setCurrentStep(FINALISING_TRANSACTION);
// Notarise and record the transaction in both parties' vaults.

SignedTransaction fullySignedTx =  subFlow(new FinalityFlow(partSignedTx, Lists.newArrayList(sessionForAccountToSendToSN,sessionForAccountToSendToDN)));

 

Error:

With the above implementation we are getting above error :-

 

[WARN ] 2020-01-22T08:08:48,112Z [flow-worker] interceptors.DumpHistoryOnErrorInterceptor. - Flow [57b61e86-63f5-4a02-99b6-78cc9f4ad83f] error [errorCode=fnyzaf, moreInformationAt=https://errors.corda.net/ENT/4.3/fnyzaf] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000016, flow-id=57b61e86-63f5-4a02-99b6-78cc9f4ad83f, invocation_id=a529ce19-b5f0-433a-a47d-d8e300d1090e, invocation_timestamp=2020-01-22T08:08:47.634Z, origin=internalShell, session_id=9e4c4931-7706-48a3-803e-e7a37c7e34a2, session_timestamp=2020-01-20T10:23:01.826Z, thread-id=253}

net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored

     at Received unexpected counter-flow exception from peer O=PartyB, L=New York, C=US.() ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.fillInLocalStackTrace(FlowStateMachineImpl.kt:179) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.processEventsUntilFlowIsResumed(FlowStateMachineImpl.kt:167) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.suspend(FlowStateMachineImpl.kt:452) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:67) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:71) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:342) ~[corda-core-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:190) ~[corda-core-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:334) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:326) ~[corda-core-4.3.jar:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:145) ~[?:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:45) ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:274) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.3.jar:?]

     at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_231]

     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_231]

     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar:4.1.29.Final]

     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]

 

Please let us know whether we are missing anything. Also are there any different approach that we are missing. Please find the attached code snippets that are being used.

It would be great if we get any sample code that is aligned with these requirement.

 

Thanks in advance,

Archita Dasgupta

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.


archita.dasgupta@...
 

Hi Team,

For better understanding, I am attaching the debugging details -



Finally the flow is exiting from RunnableFiberTask.java at line number 91.



Thanks & Regards,

Archita Dasgupta

BFS Blockchain , Kolkata

mailto:Archita.Dasgupta@...



From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 22:50
To: corda-dev@groups.io <corda-dev@groups.io>
Cc: Saha, Shivabrata (Cognizant) <Shivabrata.Saha@...>; odash@... <odash@...>
Subject: Re: [corda-dev] Account Based Implementation Queries
 
[External]

Hi Team,

We are  getting these error while executing CollectSignatureFlow for different account in the below line :-

List<? extends TransactionSignature> accountToMoveToSignatureDN = subFlow(
                    new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

Please let me know if you need any more information.

Thanks & Regards,

Archita Dasgupta

BFS Blockchain , Kolkata

mailto:Archita.Dasgupta@...



From: corda-dev@groups.io <corda-dev@groups.io> on behalf of Stefano Franz via Groups.Io <Stefano.Franz@...>
Sent: 22 January 2020 17:48
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: Re: [corda-dev] Account Based Implementation Queries
 
[External]

The error you are seeing is due to mismatched Send and Receives in the flows (UnexpectedFlowEndException. This specific error is not actually related to accounts at all. 

Could you tell us which side is that error present on? Is it during broacast or during finality? 

From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 09:44
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: [corda-dev] Account Based Implementation Queries
 

Hi Team,

 

We have a requirement to send states from an account to multiple accounts in a single transaction. These recipient accounts can reside in same node or may be in different nodes.

Right now we are able to send states from one account to another single account residing in same node. Also, in a separate transaction we are able to send to another account residing in different node. Sample codes are attached(SendInvoice.java, SendInternalInvoice.java).

 

Now we want to combine these 2 in a single transaction.

 

For these we have followed below steps. Code has been attached (SendInvoiceToMult.java) :-

 

Step 1: We are locally signing the transaction with sender’s key –

final SignedTransaction locallySignedTx = getServiceHub().signInitialTransaction(txBuilder, Lists.newArrayList(getOurIdentity().getOwningKey(), myKey.getOwningKey()));

 

Step 2: Then we are collecting signature for different node’s account –

FlowSession sessionForAccountToSendToDN = initiateFlow(targetAccountDN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureDN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

 

Step 3: Then we are collecting signature for same node’s account –

FlowSession sessionForAccountToSendToSN = initiateFlow(targetAccountSN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureSN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToSN, targetAcctAnonymousPartySN.getOwningKey()));

 

Step 4: Then we are combining these 2 signatures and calling the finality flow :-

List<TransactionSignature> allSignature = new ArrayList<>();
allSignature.addAll(accountToMoveToSignatureDN);
allSignature.addAll(accountToMoveToSignatureSN);
SignedTransaction signedByAllCounterParty = locallySignedTx.withAdditionalSignatures(allSignature);

Set<FlowSession> counterPartySessions = new HashSet<>();
counterPartySessions.add(sessionForAccountToSendToSN);
counterPartySessions.add(sessionForAccountToSendToDN);

SignedTransaction partSignedTx = subFlow(
       
new CollectSignaturesFlow(signedByAllCounterParty, counterPartySessions));
// Stage 5.
progressTracker.setCurrentStep(FINALISING_TRANSACTION);
// Notarise and record the transaction in both parties' vaults.

SignedTransaction fullySignedTx =  subFlow(new FinalityFlow(partSignedTx, Lists.newArrayList(sessionForAccountToSendToSN,sessionForAccountToSendToDN)));

 

Error:

With the above implementation we are getting above error :-

 

[WARN ] 2020-01-22T08:08:48,112Z [flow-worker] interceptors.DumpHistoryOnErrorInterceptor. - Flow [57b61e86-63f5-4a02-99b6-78cc9f4ad83f] error [errorCode=fnyzaf, moreInformationAt=https://errors.corda.net/ENT/4.3/fnyzaf] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000016, flow-id=57b61e86-63f5-4a02-99b6-78cc9f4ad83f, invocation_id=a529ce19-b5f0-433a-a47d-d8e300d1090e, invocation_timestamp=2020-01-22T08:08:47.634Z, origin=internalShell, session_id=9e4c4931-7706-48a3-803e-e7a37c7e34a2, session_timestamp=2020-01-20T10:23:01.826Z, thread-id=253}

net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored

     at Received unexpected counter-flow exception from peer O=PartyB, L=New York, C=US.() ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.fillInLocalStackTrace(FlowStateMachineImpl.kt:179) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.processEventsUntilFlowIsResumed(FlowStateMachineImpl.kt:167) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.suspend(FlowStateMachineImpl.kt:452) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:67) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:71) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:342) ~[corda-core-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:190) ~[corda-core-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:334) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:326) ~[corda-core-4.3.jar:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:145) ~[?:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:45) ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:274) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.3.jar:?]

     at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_231]

     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_231]

     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar:4.1.29.Final]

     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]

 

Please let us know whether we are missing anything. Also are there any different approach that we are missing. Please find the attached code snippets that are being used.

It would be great if we get any sample code that is aligned with these requirement.

 

Thanks in advance,

Archita Dasgupta

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.


Mike Hearn
 

There is a new error now, visible in the screenshot you just sent. The exception message in your debugger says:

"Oops. Forgot to instrument a method.  Run your program with -Dco.paralleluniverse.fibers.verifyInstrumentation=true to catch the culprit!"

So there's a method that needs an @Suspendable annotation somewhere. If you follow the instructions in the error message and add that JVM flag to your command line you should be able to make progress.

By the way, although we're happy to provide this sort of one-on-one help on corda-dev it's on a best effort basis and we get to it after our other tasks. The list is meant for discussion of developing the Corda platform itself really, and has quite a lot of people subscribed to it. Stack Overflow is a better place to ask questions, and R3 offers support options where you can get priority help with debugging.



From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: Wednesday, January 22, 2020 19:09
To: corda-dev@groups.io <corda-dev@groups.io>
Cc: odash@... <odash@...>; Shivabrata.Saha@... <Shivabrata.Saha@...>
Subject: Re: [corda-dev] Account Based Implementation Queries
 
Hi Team,

For better understanding, I am attaching the debugging details -



Finally the flow is exiting from RunnableFiberTask.java at line number 91.



Thanks & Regards,

Archita Dasgupta

BFS Blockchain , Kolkata

mailto:Archita.Dasgupta@...



From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 22:50
To: corda-dev@groups.io <corda-dev@groups.io>
Cc: Saha, Shivabrata (Cognizant) <Shivabrata.Saha@...>; odash@... <odash@...>
Subject: Re: [corda-dev] Account Based Implementation Queries
 
[External]

Hi Team,

We are  getting these error while executing CollectSignatureFlow for different account in the below line :-

List<? extends TransactionSignature> accountToMoveToSignatureDN = subFlow(
                    new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

Please let me know if you need any more information.

Thanks & Regards,

Archita Dasgupta

BFS Blockchain , Kolkata

mailto:Archita.Dasgupta@...



From: corda-dev@groups.io <corda-dev@groups.io> on behalf of Stefano Franz via Groups.Io <Stefano.Franz@...>
Sent: 22 January 2020 17:48
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: Re: [corda-dev] Account Based Implementation Queries
 
[External]

The error you are seeing is due to mismatched Send and Receives in the flows (UnexpectedFlowEndException. This specific error is not actually related to accounts at all. 

Could you tell us which side is that error present on? Is it during broacast or during finality? 

From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 09:44
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: [corda-dev] Account Based Implementation Queries
 

Hi Team,

 

We have a requirement to send states from an account to multiple accounts in a single transaction. These recipient accounts can reside in same node or may be in different nodes.

Right now we are able to send states from one account to another single account residing in same node. Also, in a separate transaction we are able to send to another account residing in different node. Sample codes are attached(SendInvoice.java, SendInternalInvoice.java).

 

Now we want to combine these 2 in a single transaction.

 

For these we have followed below steps. Code has been attached (SendInvoiceToMult.java) :-

 

Step 1: We are locally signing the transaction with sender’s key –

final SignedTransaction locallySignedTx = getServiceHub().signInitialTransaction(txBuilder, Lists.newArrayList(getOurIdentity().getOwningKey(), myKey.getOwningKey()));

 

Step 2: Then we are collecting signature for different node’s account –

FlowSession sessionForAccountToSendToDN = initiateFlow(targetAccountDN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureDN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

 

Step 3: Then we are collecting signature for same node’s account –

FlowSession sessionForAccountToSendToSN = initiateFlow(targetAccountSN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureSN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToSN, targetAcctAnonymousPartySN.getOwningKey()));

 

Step 4: Then we are combining these 2 signatures and calling the finality flow :-

List<TransactionSignature> allSignature = new ArrayList<>();
allSignature.addAll(accountToMoveToSignatureDN);
allSignature.addAll(accountToMoveToSignatureSN);
SignedTransaction signedByAllCounterParty = locallySignedTx.withAdditionalSignatures(allSignature);

Set<FlowSession> counterPartySessions = new HashSet<>();
counterPartySessions.add(sessionForAccountToSendToSN);
counterPartySessions.add(sessionForAccountToSendToDN);

SignedTransaction partSignedTx = subFlow(
       
new CollectSignaturesFlow(signedByAllCounterParty, counterPartySessions));
// Stage 5.
progressTracker.setCurrentStep(FINALISING_TRANSACTION);
// Notarise and record the transaction in both parties' vaults.

SignedTransaction fullySignedTx =  subFlow(new FinalityFlow(partSignedTx, Lists.newArrayList(sessionForAccountToSendToSN,sessionForAccountToSendToDN)));

 

Error:

With the above implementation we are getting above error :-

 

[WARN ] 2020-01-22T08:08:48,112Z [flow-worker] interceptors.DumpHistoryOnErrorInterceptor. - Flow [57b61e86-63f5-4a02-99b6-78cc9f4ad83f] error [errorCode=fnyzaf, moreInformationAt=https://errors.corda.net/ENT/4.3/fnyzaf] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000016, flow-id=57b61e86-63f5-4a02-99b6-78cc9f4ad83f, invocation_id=a529ce19-b5f0-433a-a47d-d8e300d1090e, invocation_timestamp=2020-01-22T08:08:47.634Z, origin=internalShell, session_id=9e4c4931-7706-48a3-803e-e7a37c7e34a2, session_timestamp=2020-01-20T10:23:01.826Z, thread-id=253}

net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored

     at Received unexpected counter-flow exception from peer O=PartyB, L=New York, C=US.() ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.fillInLocalStackTrace(FlowStateMachineImpl.kt:179) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.processEventsUntilFlowIsResumed(FlowStateMachineImpl.kt:167) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.suspend(FlowStateMachineImpl.kt:452) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:67) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:71) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:342) ~[corda-core-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:190) ~[corda-core-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:334) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:326) ~[corda-core-4.3.jar:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:145) ~[?:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:45) ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:274) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.3.jar:?]

     at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_231]

     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_231]

     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar:4.1.29.Final]

     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]

 

Please let us know whether we are missing anything. Also are there any different approach that we are missing. Please find the attached code snippets that are being used.

It would be great if we get any sample code that is aligned with these requirement.

 

Thanks in advance,

Archita Dasgupta

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.


archita.dasgupta@...
 

Hi Team,

 

Thanks for your kind cooperation.

For further queries we would post it in the appropriate forum.

 

Thanks & Regards,

Archita

 

From: corda-dev@groups.io <corda-dev@groups.io> On Behalf Of Mike Hearn via Groups.Io
Sent: Thursday, January 23, 2020 2:21 PM
To: archita.dasgupta via Groups.Io <archita.dasgupta@...>; corda-dev@groups.io
Cc: odash@...; Saha, Shivabrata (Cognizant) <Shivabrata.Saha@...>
Subject: Re: [corda-dev] Account Based Implementation Queries

 

[External]

There is a new error now, visible in the screenshot you just sent. The exception message in your debugger says:

 

"Oops. Forgot to instrument a method.  Run your program with -Dco.paralleluniverse.fibers.verifyInstrumentation=true to catch the culprit!"

 

So there's a method that needs an @Suspendable annotation somewhere. If you follow the instructions in the error message and add that JVM flag to your command line you should be able to make progress.

 

By the way, although we're happy to provide this sort of one-on-one help on corda-dev it's on a best effort basis and we get to it after our other tasks. The list is meant for discussion of developing the Corda platform itself really, and has quite a lot of people subscribed to it. Stack Overflow is a better place to ask questions, and R3 offers support options where you can get priority help with debugging.

 

 


From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: Wednesday, January 22, 2020 19:09
To: corda-dev@groups.io <corda-dev@groups.io>
Cc: odash@... <odash@...>; Shivabrata.Saha@... <Shivabrata.Saha@...>
Subject: Re: [corda-dev] Account Based Implementation Queries

 

Hi Team,

 

For better understanding, I am attaching the debugging details -

 

 

Finally the flow is exiting from RunnableFiberTask.java at line number 91.

 

 

Thanks & Regards,

Archita Dasgupta

BFS Blockchain , Kolkata

mailto:Archita.Dasgupta@...

 


From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 22:50
To: corda-dev@groups.io <corda-dev@groups.io>
Cc: Saha, Shivabrata (Cognizant) <Shivabrata.Saha@...>; odash@... <odash@...>
Subject: Re: [corda-dev] Account Based Implementation Queries

 

[External]

Hi Team,

 

We are  getting these error while executing CollectSignatureFlow for different account in the below line :-

 

List<? extends TransactionSignature> accountToMoveToSignatureDN = subFlow(

                    new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

 

Please let me know if you need any more information.

 

Thanks & Regards,

Archita Dasgupta

BFS Blockchain , Kolkata

mailto:Archita.Dasgupta@...

 


From: corda-dev@groups.io <corda-dev@groups.io> on behalf of Stefano Franz via Groups.Io <Stefano.Franz@...>
Sent: 22 January 2020 17:48
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: Re: [corda-dev] Account Based Implementation Queries

 

[External]

The error you are seeing is due to mismatched Send and Receives in the flows (UnexpectedFlowEndException. This specific error is not actually related to accounts at all. 



Could you tell us which side is that error present on? Is it during broacast or during finality? 


From: corda-dev@groups.io <corda-dev@groups.io> on behalf of archita.dasgupta via Groups.Io <archita.dasgupta@...>
Sent: 22 January 2020 09:44
To: corda-dev@groups.io <corda-dev@groups.io>
Subject: [corda-dev] Account Based Implementation Queries

 

Hi Team,

 

We have a requirement to send states from an account to multiple accounts in a single transaction. These recipient accounts can reside in same node or may be in different nodes.

Right now we are able to send states from one account to another single account residing in same node. Also, in a separate transaction we are able to send to another account residing in different node. Sample codes are attached(SendInvoice.java, SendInternalInvoice.java).

 

Now we want to combine these 2 in a single transaction.

 

For these we have followed below steps. Code has been attached (SendInvoiceToMult.java) :-

 

Step 1: We are locally signing the transaction with sender’s key –

final SignedTransaction locallySignedTx = getServiceHub().signInitialTransaction(txBuilder, Lists.newArrayList(getOurIdentity().getOwningKey(), myKey.getOwningKey()));

 

Step 2: Then we are collecting signature for different node’s account –

FlowSession sessionForAccountToSendToDN = initiateFlow(targetAccountDN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureDN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToDN,  targetAcctAnonymousPartyDN.getOwningKey()));

 

Step 3: Then we are collecting signature for same node’s account –

FlowSession sessionForAccountToSendToSN = initiateFlow(targetAccountSN.getHost());
List<?
extends TransactionSignature> accountToMoveToSignatureSN = subFlow(new CollectSignatureFlow(locallySignedTx, sessionForAccountToSendToSN, targetAcctAnonymousPartySN.getOwningKey()));

 

Step 4: Then we are combining these 2 signatures and calling the finality flow :-

List<TransactionSignature> allSignature = new ArrayList<>();
allSignature.addAll(accountToMoveToSignatureDN);
allSignature.addAll(accountToMoveToSignatureSN);
SignedTransaction signedByAllCounterParty = locallySignedTx.withAdditionalSignatures(allSignature);

Set<FlowSession> counterPartySessions = new HashSet<>();
counterPartySessions.add(sessionForAccountToSendToSN);
counterPartySessions.add(sessionForAccountToSendToDN);

SignedTransaction partSignedTx = subFlow(
       
new CollectSignaturesFlow(signedByAllCounterParty, counterPartySessions));
// Stage 5.
progressTracker.setCurrentStep(FINALISING_TRANSACTION);
// Notarise and record the transaction in both parties' vaults.

SignedTransaction fullySignedTx =  subFlow(new FinalityFlow(partSignedTx, Lists.newArrayList(sessionForAccountToSendToSN,sessionForAccountToSendToDN)));

 

Error:

With the above implementation we are getting above error :-

 

[WARN ] 2020-01-22T08:08:48,112Z [flow-worker] interceptors.DumpHistoryOnErrorInterceptor. - Flow [57b61e86-63f5-4a02-99b6-78cc9f4ad83f] error [errorCode=fnyzaf, moreInformationAt=https://errors.corda.net/ENT/4.3/fnyzaf] {actor_id=internalShell, actor_owning_identity=O=PartyB, L=New York, C=US, actor_store_id=NODE_CONFIG, fiber-id=10000016, flow-id=57b61e86-63f5-4a02-99b6-78cc9f4ad83f, invocation_id=a529ce19-b5f0-433a-a47d-d8e300d1090e, invocation_timestamp=2020-01-22T08:08:47.634Z, origin=internalShell, session_id=9e4c4931-7706-48a3-803e-e7a37c7e34a2, session_timestamp=2020-01-20T10:23:01.826Z, thread-id=253}

net.corda.core.flows.UnexpectedFlowEndException: Counter-flow errored

     at Received unexpected counter-flow exception from peer O=PartyB, L=New York, C=US.() ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.fillInLocalStackTrace(FlowStateMachineImpl.kt:179) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.processEventsUntilFlowIsResumed(FlowStateMachineImpl.kt:167) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.suspend(FlowStateMachineImpl.kt:452) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:67) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowSessionImpl.receive(FlowSessionImpl.kt:71) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:342) ~[corda-core-4.3.jar:?]

     at net.corda.core.flows.CollectSignatureFlow.call(CollectSignaturesFlow.kt:190) ~[corda-core-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:334) ~[corda-node-4.3.jar:?]

     at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:326) ~[corda-core-4.3.jar:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:145) ~[?:?]

     at com.example.flow.SendInvoiceToMult$Initiator.call(SendInvoiceToMult.java:45) ~[?:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:274) ~[corda-node-4.3.jar:?]

     at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.3.jar:?]

     at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]

     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_231]

     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_231]

     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar:4.1.29.Final]

     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231]

 

Please let us know whether we are missing anything. Also are there any different approach that we are missing. Please find the attached code snippets that are being used.

It would be great if we get any sample code that is aligned with these requirement.

 

Thanks in advance,

Archita Dasgupta

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.