"合同约束失败"更换旧的kotlin-source.jar文件后发生错误

时间:2018-04-10 09:05:19

标签: corda

我们更新了我们的Corda api代码并生成了一个新的包,只将CorDapp部署到包含公证人和网络地图的所有测试节点,我们只用每个节点的插件文件夹替换原始的kotlin-source.jar kotlin-source.jar的新版本,但在重新启动节点后,当我们尝试继续前一条记录时,"合约约束失败"发生错误,以下是在日志中找到的错误消息。由于所有节点都使用相同版本的kotlin-source.jar,我认为他们使用相同的CorDapp,任何人都可以提供关于合同约束失败的评论?感谢。

[WARN ] 2018-04-10T08:32:57,792Z [Node thread] flow.[d60cb4c4-f5b5-4b46-b8b2-9751165f5f34].run - Flow finished with exception
net.corda.core.contracts.TransactionVerificationException$ContractConstraintRejection: Contract constraints failed for com.legalcontract.contract.LegalContractCode, transaction: 4A6A9F6EA45CB10C92EA406F9D3E378D7BA334DC0EB48009E54A2FDA9CF86E59
at net.corda.core.transactions.LedgerTransaction.verifyConstraints(LedgerTransaction.kt:91) ~[corda-core-2.0.0.jar:?]
at net.corda.core.transactions.LedgerTransaction.verify(LedgerTransaction.kt:67) ~[corda-core-2.0.0.jar:?]
at net.corda.core.transactions.TransactionBuilder.verify(TransactionBuilder.kt:113) ~[corda-core-2.0.0.jar:?]
at com.legalcontract.flow.LegalContractFlow$Initiator.call(LegalContractFlow.kt:261) ~[kotlin-source.jar:?]
at com.legalcontract.flow.LegalContractFlow$Initiator.call(LegalContractFlow.kt:47) ~[kotlin-source.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:96) [corda-node-2.0.0.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:41) [corda-node-2.0.0.jar:?]
at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_162]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_162]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [?:1.8.0_162]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:1.8.0_162]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_162]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_162]
at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:69) [corda-node-2.0.0.jar:?]

1 个答案:

答案 0 :(得分:0)

在Corda 3中,除非您另行指明,否则交易使用HashAttachmentConstraint指定哪些合约管辖它。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>hu.javacity.app.buildingsofcities</groupId> <artifactId>city</artifactId> <name>WildFly Swarm Example</name> <version>1.0.0-SNAPSHOT</version> <packaging>war</packaging> <properties> <version.wildfly.swarm>2018.4.1</version.wildfly.swarm> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <failOnMissingWebXml>false</failOnMissingWebXml> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.wildfly.swarm</groupId> <artifactId>bom-all</artifactId> <version>${version.wildfly.swarm}</version> <scope>import</scope> <type>pom</type> </dependency> </dependencies> </dependencyManagement> <build> <finalName>demo</finalName> <plugins> <plugin> <groupId>org.wildfly.swarm</groupId> <artifactId>wildfly-swarm-plugin</artifactId> <version>${version.wildfly.swarm}</version> <executions> <execution> <goals> <goal>package</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <!-- Java EE 7 dependency --> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> <!-- WildFly Swarm Fractions --> </dependencies> </project> 指定包含合同的JAR文件的哈希必须是什么。这意味着如果您更改合同 - 或该JAR 中的任何文件 - JAR哈希将发生变化,合同将不再被识别。

您需要使用Corda的明确合同升级功能明确升级合同。请参阅合同升级示例here和文档here