0
私はcorda tutorial pt 2のチュートリアルにkotlinを使用しています。cordaの契約確認に失敗しましたHello World pt 2
Done
Contract verification failed: List has more than one element., contract: [email protected], transaction: D08920023D788F80F289527BD9C27BCD54B7DAC6C53866BFA7B90B23E0E4749B
IOUFlowクラス:
@InitiatingFlow
@StartableByRPC
class IOUFlow(val iouValue: Int,
val otherParty: Party) : FlowLogic<Unit>() {
override val progressTracker = ProgressTracker()
@Suspendable
override fun call() {
val notary = serviceHub.networkMapCache.notaryIdentities[0]
val outputState = IOUState(iouValue, ourIdentity, otherParty)
val outputContract = IOUContract::class.jvmName
val outputContractAndState = StateAndContract(outputState, outputContract)
val cmd = Command(IOUContract.Create(), listOf(ourIdentity.owningKey, otherParty.owningKey))
val txBuilder = TransactionBuilder(notary = notary)
.addOutputState(outputState, TEMPLATE_CONTRACT_ID)
.addCommand(cmd)
txBuilder.withItems(outputContractAndState, cmd)
txBuilder.verify(serviceHub)
val signedTx = serviceHub.signInitialTransaction(txBuilder)
val otherpartySession = initiateFlow(otherParty)
val fullySignedTx = subFlow(CollectSignaturesFlow(signedTx, listOf(otherpartySession), CollectSignaturesFlow.tracker()))
subFlow(FinalityFlow(fullySignedTx))
}
}
start IOUFlow iouValue: 30, otherParty: "C=US, L=New York, O=PartyB"
私は契約検証失敗情報を取得する:毎回私は、次のコマンドを使用してPartyAでクラッシュシェル経由で新しいフローを開始しよう私は運がないこの問題に対処するApp.ktを変更しようとしました。誰が問題が何であるか知っていますか?
ご協力いただきありがとうございます。
val txBuilder = TransactionBuilder(notary = notary)
.addOutputState(outputState, TEMPLATE_CONTRACT_ID)
.addCommand(cmd)
txBuilder.withItems(outputContractAndState, cmd)
を使用すると、2つの出力の代わりの1を持っているように、これは、契約確認が失敗する:
Joelに感謝します。重複した 'cmd'と' outputState'を削除すると、そのトリックができました。 – jgmh