广播事务未注册,Corda

广播事务未注册,Corda,corda,Corda,调用BroadcastTransaction时引发以下错误: Party C=GB,L=London,O=Controller rejected session request: class ee.ut.cs.examples.parking.flows.BroadcastTransaction is not registered 这是我想要调用BroadcastTransaction的流程逻辑 package ee.ut.cs.examples.parking.flows im

调用BroadcastTransaction时引发以下错误:

Party C=GB,L=London,O=Controller rejected session request: 
    class ee.ut.cs.examples.parking.flows.BroadcastTransaction is not registered 
这是我想要调用BroadcastTransaction的流程逻辑

package ee.ut.cs.examples.parking.flows

import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.Command
import net.corda.core.contracts.StateAndContract
import net.corda.core.flows.FinalityFlow
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.StartableByRPC
import net.corda.core.identity.Party
import net.corda.core.transactions.SignedTransaction
import net.corda.core.transactions.TransactionBuilder
import ee.ut.cs.examples.parking.contracts.ParkingSpaceContract
import ee.ut.cs.examples.parking.structures.ParkingSpace

@StartableByRPC
class CreateParkingSpace(private val dayRate: Double, private val nightRate: Double) : FlowLogic<SignedTransaction>() {
    @Suspendable
    override fun call(): SignedTransaction {
        val notary: Party = serviceHub.networkMapCache.notaryIdentities.first()

        val parkingSpace = ParkingSpace(owner = ourIdentity, dayRate = dayRate, nightRate = nightRate)
        val createCommand = Command(ParkingSpaceContract.Commands.Create(), listOf(ourIdentity.owningKey))
        val outputState = StateAndContract(parkingSpace, ParkingSpaceContract.CONTRACT_REF)

        val utx = TransactionBuilder(notary = notary).withItems(outputState, createCommand)

        val stx = serviceHub.signInitialTransaction(utx)
        val ftx = subFlow(FinalityFlow(stx))

        subFlow(BroadcastTransaction(ftx))

        return ftx
    }


}
包ee.ut.cs.examples.parking.flows
进口公司paralleluniverse.fibers.Suspendable
导入net.corda.core.contracts.Command
导入net.corda.core.contracts.StateAndContract
导入net.corda.core.flows.FinalityFlow
导入net.corda.core.flows.FlowLogic
导入net.corda.core.flows.StartableByRPC
导入net.corda.core.identity.Party
导入net.corda.core.transactions.SignedTransaction
导入net.corda.core.transactions.TransactionBuilder
导入ee.ut.cs.examples.parking.contracts.ParkingSpaceContract
导入ee.ut.cs.examples.parking.structures.ParkingSpace
@星表
类CreateParkingSpace(private val dayRate:Double,private val nightRate:Double):FlowLogic(){
@暂停
重写趣味调用():SignedTransaction{
val公证人:Party=serviceHub.networkMapCache.notaryIdentity.first()
val parkingSpace=停车空间(所有者=用户身份,日费率=日费率,夜费率=夜费率)
val createCommand=Command(ParkingSpaceContract.Commands.Create(),listOf(ourIdentity.owningKey))
val outputState=状态和合同(parkingSpace,ParkingSpaceContract.CONTRACT\u REF)
val utx=TransactionBuilder(公证人=公证人)。withItems(outputState,createCommand)
val stx=serviceHub.signInitialTransaction(utx)
val ftx=子流(最终流(stx))
子流(广播事务(ftx))
返回ftx
}
}
以下是交易记录:

import co.paralleluniverse.fibers.Suspendable
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.InitiatingFlow
import net.corda.core.flows.SendTransactionFlow
import net.corda.core.transactions.SignedTransaction

/**
 * Filters out any notary identities and removes our identity, then broadcasts the [SignedTransaction] to all the
 * remaining identities.
 */
@InitiatingFlow
class BroadcastTransaction(val stx: SignedTransaction) : FlowLogic<Unit>() {

    @Suspendable
    override fun call() {
        // Get a list of all identities from the network map cache.
        val everyone = serviceHub.networkMapCache.allNodes.flatMap { it.legalIdentities }

        // Filter out the notary identities and remove our identity.
        val everyoneButMeAndNotary = everyone.filter { serviceHub.networkMapCache.isNotary(it).not() } - ourIdentity

        // Create a session for each remaining party.
        val sessions = everyoneButMeAndNotary.map { initiateFlow(it) }

        // Send the transaction to all the remaining parties.
        sessions.forEach { subFlow(SendTransactionFlow(it, stx)) }
    }

}
import co.paralleluniverse.fibers.Suspendable
导入net.corda.core.flows.FlowLogic
导入net.corda.core.flows.initialingflow
导入net.corda.core.flows.SendTransactionFlow
导入net.corda.core.transactions.SignedTransaction
/**
*过滤掉任何公证人身份并删除我们的身份,然后将[SignedTransaction]广播给所有
*剩下的身份。
*/
@启动流
类BroadcastTransaction(val stx:SignedTransaction):FlowLogic(){
@暂停
覆盖有趣的调用(){
//从网络映射缓存中获取所有标识的列表。
val everyone=serviceHub.networkMapCache.allNodes.flatMap{it.Legalidentials}
//过滤掉公证人身份并删除我们的身份。
val everyoneButMeAndNotary=everyone.filter{serviceHub.networkMapCache.isNotary(it).not()}-ourIdentity
//为其余各方创建会话。
val sessions=everyoneButMeAndNotary.map{initiateFlow(it)}
//将交易发送给所有剩余方。
sessions.forEach{subFlow(SendTransactionFlow(it,stx))}
}
}

这是一个
会话拒绝异常

引发此问题的原因是,从
BroadcastTransaction
接收消息的节点没有注册流以响应
BroadcastTransaction

您需要在表单的接收节点上安装响应程序流:

@InitiatedBy(BroadcastTransaction::class)
class Responder(val counterpartySession: FlowSession) : FlowLogic<Unit>() {
    @Suspendable
    override fun call() {
        // TODO: Flow logic here.
    }
}
@InitiatedBy(BroadcastTransaction::class)
类响应程序(val countpartysession:FlowSession):FlowLogic(){
@暂停
覆盖有趣的调用(){
//TODO:这里是流程逻辑。
}
}