【问题标题】:Where does Corda load attachment files from during verification?Corda 在验证期间从哪里加载附件文件?
【发布时间】:2020-06-16 02:30:10
【问题描述】:

在新提议的事务上收集签名时,Corda 由于命名空间冲突而抛出了OverlappingAttachmentsException。错误消息似乎是正确的,因为在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


    【解决方案1】:

    结果证明这是由 Corda 3.3 中的合约哈希约束与 Corda 4.3 中的新合约签名约束之间的冲突引起的。为防止此错误,必须在节点上禁用哈希约束。

    根据文档,节点必须使用以下 JVM 选项启动:-Dnet.corda.node.disableHashConstraints="true"

    https://docs.corda.net/docs/corda-os/4.3/api-contract-constraints.html#hash-constrained-states-in-private-networks

    来自升级指南:“升级 CorDapp 以使用 Corda 4 签名约束并使用以旧约束类型发布的分类帐上的现有状态(例如,使用哈希或 CZ 白名单约束发布的 Corda 3.x 状态)。”

    https://docs.corda.net/docs/corda-os/4.3/app-upgrade-notes.html#step-9-learn-about-signature-constraints-and-jar-signing

    【讨论】:

      猜你喜欢
      • 2012-04-07
      • 2015-05-28
      • 2011-06-23
      • 1970-01-01
      • 2016-06-17
      • 1970-01-01
      • 2011-01-21
      • 1970-01-01
      • 2016-01-27
      相关资源
      最近更新 更多