代码之家  ›  专栏  ›  技术社区  ›  Adrian

广播旧事务将导致两个未使用的状态

  •  1
  • Adrian  · 技术社区  · 6 年前

    在Corda 3.0 Postgres 9.6。

    假设有一个 LinearState 在已转换为

    A lifecycle in Tx1 -> B lifecycle in Tx2 -> C lifecycle in Tx3 -> D lifecycle in Tx4 是的。

    我有一个空保险库的监管者。当银行发出 Tx4 给监管机构调节器将没有消耗 线性状态 D lifecycle 在里面 vault_states -很好也很好。

    如果银行错误地发送 Tx2 在上述操作之后,监管者将记录同一UUID的两个未使用状态 B lifecycle ,和 D生命周期 快照。这是预期的行为吗?

    另一种情况

    1. 如果银行 TX2型 首先然后 TX4 按顺序,两个 TX2型 TX4型 未消耗
    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)
        }
    }
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Joel    6 年前

    这似乎是个虫子。它在这里被追踪: https://r3-cev.atlassian.net/browse/CORDA-1828 是的。