どーものぶこふです。
今回はCorda4系を使っていくうえで、少しハマったところをメモ書き程度に記述しておきます。
※秋頃には5.0がでるとかなんとか・・・
<FinalityFlow>には、参加者全員のセッションリストが必要
こんなエラーが出ます
java.lang.IllegalArgumentException: Flow sessions were not provided for the following transaction participants:
対応
otherSessionに適切なPartyを指定する
val counterPartySession = initiateFlow(counterParty) //←適切なPartyを指定
val fullySignedTx = subFlow(CollectSignaturesFlow(signedTransaction, setOf(counterPartySession)))
subFlow(new FinalityFlow(fullySignedTx、counterPartySession)
参考
くりす「Corda4から、FinalityFlowにはトランザクション参加者全員のセッションリストが必要になったのさ」(※意訳)
自身に対してFlowを実行するとエラーが発生する
こんなエラーが出ます
Do not provide flow sessions for the local node. FinalityFlow will record the notarised transaction locally.
対応
emptyListを渡す
subFlow(FinalityFlow(signedTransaction, emptyList()))
※自身に対してFlowを実行するのが確実なのであれば、CollectSignaturesFlow
などは不要ですね
参考
https://stackoverflow.com/questions/56425416/flow-error-when-trying-to-initiate-a-new-iouflow
↓
https://groups.io/g/corda-dev/topic/flow_issues_in_4_0_rc4/29986269?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,29986269
まいくはーん「emptyListを渡せば解決するでよ!!」(※意訳)
【追記】2019/07/19:<CollectSignaturesFlow>実行時に、署名が過不足しているとエラーが発生する
こんなエラーが出ます
The Initiator of CollectSignaturesFlow must pass in exactly the sessions required to sign the transaction.
対応
適切な数のセッションリストを作成して渡す
// 適切なセッションリストを作成する
val counterPartySession1 = initiateFlow(partyA)
val counterPartySession2 = initiateFlow(partyB)
val sessionList = setOf(counterPartySession1,counterPartySession2)
// そのセッションリストを渡す
val fullySignedTx = subFlow(CollectSignaturesFlow(signedTransaction, sessionList))
おわり
そんなこんなで、Cordaと戯れています。
今回はここまでです。
ありがとうございました。