在 Corda 中,如何查看未完成流程中的待处理交易?
In Corda, how can I see pending transactions in uncompleted flows?
在 Corda 中,假设我是 运行 创建交易的流程。我已经签署了交易,但现在流程暂停等待交易对方签署。
有什么方法可以让我看到以这种方式待处理的交易列表吗?
从 Corda 3 开始,您无法看到这些交易的内容。
但是,您可以使用流程进度跟踪器步骤来找出每个流程在其生命周期中的位置。例如,您可以计算在某些用户定义的 Transaction is pending.
进度跟踪器步骤中暂停的流的数量,如下所示:
class Client {
val proxy: CordaRPCOps
init {
val nodeAddress = NetworkHostAndPort.parse("localhost:10006")
val client = CordaRPCClient(nodeAddress)
proxy = client.start("user1", "test").proxy
}
fun currentNumberOfPendingTxs(): Int {
val stateMachineInfos = proxy.stateMachinesSnapshot()
val stateMachinesPendingTxs = stateMachineInfos.filter { info ->
val progressTracker = info.progressTrackerStepAndUpdates
if (progressTracker == null) {
false
} else {
progressTracker.snapshot == "Transaction is pending."
}
}
return stateMachinesPendingTxs.size
}
}
在 Corda 中,假设我是 运行 创建交易的流程。我已经签署了交易,但现在流程暂停等待交易对方签署。
有什么方法可以让我看到以这种方式待处理的交易列表吗?
从 Corda 3 开始,您无法看到这些交易的内容。
但是,您可以使用流程进度跟踪器步骤来找出每个流程在其生命周期中的位置。例如,您可以计算在某些用户定义的 Transaction is pending.
进度跟踪器步骤中暂停的流的数量,如下所示:
class Client {
val proxy: CordaRPCOps
init {
val nodeAddress = NetworkHostAndPort.parse("localhost:10006")
val client = CordaRPCClient(nodeAddress)
proxy = client.start("user1", "test").proxy
}
fun currentNumberOfPendingTxs(): Int {
val stateMachineInfos = proxy.stateMachinesSnapshot()
val stateMachinesPendingTxs = stateMachineInfos.filter { info ->
val progressTracker = info.progressTrackerStepAndUpdates
if (progressTracker == null) {
false
} else {
progressTracker.snapshot == "Transaction is pending."
}
}
return stateMachinesPendingTxs.size
}
}