广播旧交易将导致 2 个未消费状态

Broadcasting an old transaction will cause 2 unconsumed states

Corda 3.0 Postgres 9.6.

假设银行节点中有一个 LinearState 已转换为

A lifecycle in Tx1 -> B lifecycle in Tx2 -> C lifecycle in Tx3 -> D lifecycle in Tx4.

我有一个带空金库的调节器。使用可观察概念,当银行向监管机构发送 Tx4 时。调节器将在 vault_states 中的 D lifecycle 处有未消耗的 LinearState - 这很好。

如果银行在上述之后错误地向监管机构发送Tx2,那么监管机构将在B lifecycleD lifecycle快照中记录2个相同UUID的UNCONSUMED状态。这是预期的行为吗?

另一个场景

  1. 如果银行先发送Tx2,然后依次发送Tx4,则Tx2Tx4都未被消费
  2. 如果银行先发送Tx2,然后依次发送Tx3,则Tx2会被消费,Tx3不会被消费。

下面的代码片段

class ReportToCounterparty(
private val regulator: Party, 
private val signedTx: SignedTransaction) : FlowLogic<SignedTransaction>() {

    @Suspendable
    override fun call(): SignedTransaction {
        val session = initiateFlow(regulator)

        subFlow(IdentitySyncFlow.Send(session, signedTx.tx))

        subFlow(SendTransactionFlow(session, signedTx))
        return session.receive<SignedTransaction>().unwrap { it }
    }
}


@InitiatedBy(ReportToCounterparty::class)
    class ReceiveReportedTransaction(private val otherSideSession: FlowSession) : FlowLogic<Unit>() {

    @Suspendable
    override fun call() {
        // TODO: add error handling

        subFlow(IdentitySyncFlow.Receive(otherSideSession))

        val recorded = subFlow(ReceiveTransactionFlow(otherSideSession, true, StatesToRecord.ALL_VISIBLE))

        otherSideSession.send(recorded)
    }
}

这似乎是一个错误。它被跟踪在这里:https://r3-cev.atlassian.net/browse/CORDA-1828.