Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在corda中使用帐户和oracle时,谓词返回false_Corda - Fatal编程技术网

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

在corda中使用帐户和oracle时,谓词返回false,corda,Corda,我试图在corda中使用accounts功能和oracle功能,问题在于构建一个过滤函数来获取oracle签名。我的kotlin代码使用谓词检查我的事务中是否包含oracle密钥,它始终返回false,即使我在用于签名初始事务的公钥列表中添加了oracle publickey var requiredSigners = Arrays.asList(oracle.owningKey, urIdentity.owningKey, lenderAccountNewKey) val output = I

我试图在corda中使用accounts功能和oracle功能,问题在于构建一个过滤函数来获取oracle签名。我的kotlin代码使用谓词检查我的事务中是否包含oracle密钥,它始终返回false,即使我在用于签名初始事务的公钥列表中添加了oracle publickey

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)


var requiredSigners=Arrays.asList(oracle.owningKey、urIdentity.owningKey、lenderAccountNewKey)
val输出=IoState(exchangeRate*值、lenderAccountNewKey、借款AccountNewKey)
val transactionBuilder=transactionBuilder(公证人)
var participantsList=ArrayList(output.participants)
参与者列表添加(oracle)
transactionBuilder.addOutputState(输出,IOUContract.ID)
.addCommand(IOUContract.Commands.Create(),participantsList.map{it.owningKey})
transactionBuilder.verify(serviceHub)
var localSignedTx=serviceHub.signInitialTransaction(transactionBuilder)
var filteredTx=localSignedTx.buildFilteredTransaction(谓词{
什么时候{
是命令->oracle.owningKey在it.signers中吗
else->false
}
}
val oracleSignature=子流(SignFlow(oracle、filteredTransaction))
val stx=locallySignedTransaction.withAdditionalSignature(oracleSignature)
当尝试使用以下代码运行时,下面给出了日志

[INFO]2020-05-26T07:00:59660Z[Node thread-1]corda.flow.-flow引发错误:集合不包含与谓词匹配的元素..将其发送到flow医院进行分类。 {actor\u id=internalShell,actor\u owning\u identity=O=PartyA,L=London, C=GB,参与者\存储\ id=NODE\配置,光纤id=10000003, 流量id=040d69f9-f93a-4a23-bdb4-594c41d38987, 调用id=3da3d8a0-64ec-4a41-8f18-b0ca05557490, 调用时间戳=2020-05-26T07:00:58.102Z,原点=internalShell, 会话id=dec88c8e-1441-425b-bfe0-f00ad6b12126, 会话时间戳=2020-05-26T06:58:59.126Z,线程id=161}[INFO] 2020-05-26T07:00:59666Z[节点线程-1] statemachine.StaffedFlow医院-流量 [040d69f9-f93a-4a23-bdb4-594c41d38987]在州医院住院

  • 指定命令时应传递
    requiredSigners
    列表;当前传递的是
    participantsList
  • 另一方面,oracle不应该是参与者;它通常是提供验证数据的第三方。
    如果您要通过将oracle作为参与者(假设您将在最终流程中使用
    participantsList
    ),在oracle内部注册完整事务和相关状态,那么向oracle发送过滤事务有什么意义
  • 您应该使用
    WireTransaction
    来构建过滤后的事务(即
    localSignedTx.tx.buildFilteredTransaction()
    )(请注意
    .tx
  • 如果输入错误,请在
    SignFlow
    中使用
    filteredTransaction
    ;变量名为
    filteredTx