Kotlin 找不到流的合同附件
将corda升级到版本4后,我得到net.corda.core.transactions.MissingContractAttachments:找不到com.template.contract.ServiceContractnull的合同附件 此流在本地工作,但在部署到Azure时抛出错误消息 我有Kotlin 找不到流的合同附件,kotlin,corda,Kotlin,Corda,将corda升级到版本4后,我得到net.corda.core.transactions.MissingContractAttachments:找不到com.template.contract.ServiceContractnull的合同附件 此流在本地工作,但在部署到Azure时抛出错误消息 我有 已检查my all my cordapps是否位于/opt/corda/cordapps-文件夹中 我的合同ID是“com.template.contract.ServiceContract” 我
- 已检查my all my cordapps是否位于/opt/corda/cordapps-文件夹中
- 我的合同ID是“com.template.contract.ServiceContract”
- 我没有做任何测试
@InitiatingFlow
@StartableByRPC
class CreateServiceFlow(val serviceState: ServiceState) : FlowLogic<SignedTransaction>() {
override val progressTracker = ProgressTracker()
@Suspendable
override fun call(): SignedTransaction {
serviceHub.vaultService.queryBy<ServiceState>().states.forEach{
if (it.state.data.serviceName == serviceState.serviceName) {
throw Exception("There can be only one ${serviceState.serviceName} service per service " +
"provider")
}
}
val notary = serviceHub.networkMapCache.notaryIdentities.first()
val serviceCommand = Command(
ServiceContract.Commands.IssueService(),
serviceState.participants.map { it.owningKey }
)
val builder = TransactionBuilder(notary = notary)
.addOutputState(serviceState, ServiceContract.SERVICE_CONTRACT_ID,
constraint = AlwaysAcceptAttachmentConstraint)
.addCommand(serviceCommand)
builder.verify(serviceHub)
val partSignedTx = serviceHub.signInitialTransaction(builder)
val otherPartySession = initiateFlow(serviceState.accountOperator)
val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx, setOf(otherPartySession)))
return subFlow(FinalityFlow(fullySignedTx, setOf(otherPartySession)))
}
}
@InitiatedBy(CreateServiceFlow::class)
class IssueServiceResponder(val otherPartySession: FlowSession) : FlowLogic<SignedTransaction>() {
@Suspendable
override fun call(): SignedTransaction {
val signTransactionFlow = object : SignTransactionFlow(otherPartySession) {
override fun checkTransaction(stx: SignedTransaction) = requireThat {
"there should be no inputs" using(stx.inputs.isEmpty())
"there should be one output" using(stx.tx.outputStates.size == 1)
"The state should serviceState" using(stx.tx.outputStates.single() is ServiceState)
}
}
val txId = subFlow(signTransactionFlow).id
return subFlow(ReceiveFinalityFlow(otherPartySession, expectedTxId = txId))
}
}
更新:这是我在本地运行相同流时得到的响应
{
"wire": {
"id": "3EDD9204FF70AF2B36D78219690946004C7D5625D347F04EE55980A8600141BF",
"notary": "O=NetworkMapAndNotary, L=Helsinki, C=FI",
"inputs": [],
"outputs": [
{
"data": {...},
"contract": "com.template.contract.ServiceContract",
"notary": "O=NetworkMapAndNotary, L=Helsinki, C=FI",
"encumbrance": null,
"constraint": {
"@class": "net.corda.core.contracts.AlwaysAcceptAttachmentConstraint"
}
}
],
"commands": [
{
"value": {
"@class": "com.template.contract.ServiceContract$Commands$IssueService"
},
"signers": [
"GfHq2tTVk9z4eXgyVMCDbvndZWywoFqaPKbGgxeqVUEVBYgpNTqFTqc7mVqe",
"GfHq2tTVk9z4eXgyWB97whuGdtsB8c7EByHbsTxkdsNq695JX8PKSwDPq3d9"
]
}
],
"timeWindow": null,
"attachments": [
"17B22D590137C675AC1B61B7052CCEF739AA36223865BBFF707E6CB2F933FBF0"
],
"references": [],
"privacySalt": "0AFC86A1BBF6D897CCC5AA56F0FC0474DE4CD618FF040BAA96293BAA1BCDBCAF",
"networkParametersHash": "31AF29974115E6BE4418C4080F58DFD77F301E45DC35A05DB855B0D1B25966B2"
},
"signatures": [...]
}
在Azure部署中,您是否在
节点.conf
中运行devMode=false
可能是您的代码由corda dev密钥签名,该密钥只能在开发模式下使用(因为该密钥不安全),这意味着部署的节点没有加载您的CorDapp
为了测试这是否是azure部署中的问题,您可以尝试将此行添加到节点.conf
:
cordappSignerKeyFingerprintBlacklist=[]
默认情况下,Corda dev密钥位于该列表中,在该列表中清空将导致加载应用程序。有关更多信息,请参阅
您可以在此处阅读有关签署JAR的更多信息:
是的,node.conf中确实存在
devMode=false
。这就解决了,谢谢。
{
"wire": {
"id": "3EDD9204FF70AF2B36D78219690946004C7D5625D347F04EE55980A8600141BF",
"notary": "O=NetworkMapAndNotary, L=Helsinki, C=FI",
"inputs": [],
"outputs": [
{
"data": {...},
"contract": "com.template.contract.ServiceContract",
"notary": "O=NetworkMapAndNotary, L=Helsinki, C=FI",
"encumbrance": null,
"constraint": {
"@class": "net.corda.core.contracts.AlwaysAcceptAttachmentConstraint"
}
}
],
"commands": [
{
"value": {
"@class": "com.template.contract.ServiceContract$Commands$IssueService"
},
"signers": [
"GfHq2tTVk9z4eXgyVMCDbvndZWywoFqaPKbGgxeqVUEVBYgpNTqFTqc7mVqe",
"GfHq2tTVk9z4eXgyWB97whuGdtsB8c7EByHbsTxkdsNq695JX8PKSwDPq3d9"
]
}
],
"timeWindow": null,
"attachments": [
"17B22D590137C675AC1B61B7052CCEF739AA36223865BBFF707E6CB2F933FBF0"
],
"references": [],
"privacySalt": "0AFC86A1BBF6D897CCC5AA56F0FC0474DE4CD618FF040BAA96293BAA1BCDBCAF",
"networkParametersHash": "31AF29974115E6BE4418C4080F58DFD77F301E45DC35A05DB855B0D1B25966B2"
},
"signatures": [...]
}
cordappSignerKeyFingerprintBlacklist=[]