我已经实现了这里描述的用户交互流程:Corda: User interaction for verifying the transaction request received from the initiator node。
作为投标人,我如何检查交易是否被接受或拒绝?
发布于 2018-03-15 10:18:28
您可以使用RPC客户端,如下所示:
fun main(args: Array<String>) {
val nodeAddress = parse(args[0])
val client = CordaRPCClient(nodeAddress)
val proxy = client.start("user1", "test").proxy
// Observe FooState updates from the vault.
val (_, updates) = proxy.vaultTrack(FooState::class.java)
// Check each update.
updates.toBlocking().subscribe { update ->
// If the update produced a state with the `accepted` flag, the proposal was accepted.
if (update.produced.size == 1 && update.produced.single().state.data.accepted) {
logger.info("Proposal was accepted.")
// If the update didn't produce a state, the proposal was rejected.
} else if (update.produced.isEmpty()) {
logger.info("Proposal was rejected.")
}
}
}https://stackoverflow.com/questions/49296835
复制相似问题