[corda中使用帐户和oracle时谓词返回false

问题描述 投票:0回答:1

我正在尝试在Corda中使用帐户功能以及oracle功能,问题在于构建用于获取oracle签名的过滤功能。我的kotlin代码使用谓词检查我的交易中是否包含oracle密钥,即使我在用于签署初始交易的公共密钥列表中添加了oracle publickey,也始终返回false。

var requiredSigners = Arrays.asList(oracle.owningKey, urIdentity.owningKey, lenderAccountNewKey)
val output = IOUState(exchangeRate * value, lenderAccountNewKey, borrowerAccountNewKey)
    val transactionBuilder = TransactionBuilder(notary)
    var participantsList = ArrayList<AbstractParty>(output.participants)
    participantsList.add(oracle)
    transactionBuilder.addOutputState(output, IOUContract.ID)
            .addCommand(IOUContract.Commands.Create(), participantsList.map { it.owningKey })
    transactionBuilder.verify(serviceHub)

 var localSignedTx = serviceHub.signInitialTransaction(transactionBuilder)

        var filteredTx = localSignedTx.buildFilteredTransaction(Predicate {
            when (it) {
                is Command<*> -> oracle.owningKey in it.signers
                else -> false
            }
        }
val oracleSignature = subFlow(SignFlow(oracle, filteredTransaction))
    val stx = locallySignedTransaction.withAdditionalSignature(oracleSignature)


当尝试使用以下代码运行时,日志在下面给出。

[[INFO] 2020-05-26T07:00:59,660Z [Node thread-1] corda.flow。 -流程引发错误:集合不包含与谓词匹配的元素。将其发送到流程医院进行分类。{actor_id = internalShell,actor_owning_identity = O = PartyA,L =伦敦,C = GB,actor_store_id = NODE_CONFIG,fiber-id = 10000003,flow-id = 040d69f9-f93a-4a23-bdb4-594c41d38987,invocation_id = 3da3d8a0-64ec-4a41-8f18-b0ca05557490,invocation_timestamp = 2020-05-26T07:00:58.102Z,origin = internalShell,session_id = dec88c8e-1441-425b-bfe0-f00ad6b12126,session_timestamp = 2020-05-26T06:58:59.126Z,thread-id = 161} [信息]2020-05-26T07:00:59,666Z [节点线程1]状态机.StaffedFlowHospital。 - 流[040d69f9-f93a-4a23-bdb4-594c41d38987]已在州内入院

corda
1个回答
0
投票
  • 指定命令时,您应该传递requiredSigners列表;当前您正在通过participantsList
  • 附带说明,甲骨文不应该是参与者;通常是第三方提供经过验证的数据。向oracle发送经过过滤的交易有什么意义,如果您要通过使其成为参与者来在oracle中注册该完整的交易和相关状态(假设participantsList是您将在结局流程中使用的货币) 。
© www.soinside.com 2019 - 2024. All rights reserved.