corda - Corda 在验证期间从哪里加载附件文件?
问题描述
在为新提议的事务收集签名时,CordaOverlappingAttachmentsException
由于命名空间冲突而抛出了一个错误。错误消息似乎是正确的,因为node_attachments
表中有两个附件包含相同的合同命名空间。
net.corda.core.contracts.TransactionVerificationException$OverlappingAttachmentsException:
Multiple attachments define a file at com/foo/company/<state>/api/v2/orderdetails.class., transaction: 1C1985615C0B53F228B22B2C4F05CE039CC6C577A87E3B2FC9AA2CB00ED5FC43
at net.corda.core.serialization.internal.AttachmentsClassLoader.checkAttachments(AttachmentsClassLoader.kt:272) ~[corda-core-4.3.jar:?]
at net.corda.core.serialization.internal.AttachmentsClassLoader.<init>(AttachmentsClassLoader.kt:132) ~[corda-core-4.3.jar:?]
at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder$withAttachmentsClassloaderContext$serializationContext$1.apply(AttachmentsClassLoader.kt:325) ~[corda-core-4.3.jar:?]
at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder$withAttachmentsClassloaderContext$serializationContext$1.apply(AttachmentsClassLoader.kt:298) ~[corda-core-4.3.jar:?]
at java.util.HashMap.computeIfAbsent(HashMap.java:1127) ~[?:1.8.0_212]
at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2672) ~[?:1.8.0_212]
at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder.withAttachmentsClassloaderContext(AttachmentsClassLoader.kt:323) ~[corda-core-4.3.jar:?]
at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder.withAttachmentsClassloaderContext$default(AttachmentsClassLoader.kt:319) ~[corda-core-4.3.jar:?]
at net.corda.core.transactions.LedgerTransaction.internalPrepareVerify$core(LedgerTransaction.kt:146) ~[corda-core-4.3.jar:?]
at net.corda.core.transactions.LedgerTransaction.verify(LedgerTransaction.kt:136) ~[corda-core-4.3.jar:?]
at net.corda.core.flows.CollectSignaturesFlow.call(CollectSignaturesFlow.kt:103) ~[corda-core-4.3.jar:?]
at net.corda.core.flows.CollectSignaturesFlow.call(CollectSignaturesFlow.kt:67) ~[corda-core-4.3.jar:?]
Corda 在验证期间从哪里加载附件文件?我的印象是 Corda 只会从部署到节点cordapps
文件夹的 cordapps 中加载验证合同,而不是尝试使用保存在node_attachments
表中的合同。
如果 Corda 确实从节点库加载了合约,那么它是否遵循任何时候部署新的合约 cordapp 时它应该有一个唯一的包命名空间?
作为参考,此错误发生在测试 cordapp 升级到 Corda 4.3 的过程中。
解决方案
事实证明,这是由 Corda 3.3 中的合约哈希约束与 Corda 4.3 中的新合约签名约束之间的冲突引起的。为防止此错误,必须在节点上禁用哈希约束。
根据文档,节点必须使用此 JVM 选项启动:-Dnet.corda.node.disableHashConstraints="true"
来自升级指南:“升级 CorDapp 以使用 Corda 4 签名约束并使用旧约束类型发布的分类帐上的现有状态(例如,使用哈希或 CZ 白名单约束发布的 Corda 3.x 状态)。”
推荐阅读
- ios - 如何在 XCode 中下载已删除的 iOS 模拟器?
- reactjs - ErrorBoundary 将当前内容替换为 fallbackRender 而不是将其添加到顶部
- regex - 从我的公式结果中删除最后一个特定字符
- java - 正则表达式从句子中获取金额不适用于一种情况
- sql - 按每组扩展缺失日期的数据
- reactjs - 编辑或删除文档时,Firestore 集合侦听器崩溃
- python - 创建取自数据框行的多条线图
- vb.net - 如何在 2gb 文件以上的 vb.net 中设置字节值
- php - 是否可以通过 IMAP 在特定电子邮件上设置自定义标志,然后过滤带有/不带有此自定义标志的电子邮件?
- excel - 从值表创建条形图时,为什么会遇到“找不到具有指定名称的项目”?