如何区分节点参与或广播的交易与 txs 链

how to differentiate transactions that the node is involved in or broadcasted vs the chain of txs

问题:有没有办法区分节点参与或广播的交易与 txs 链

场景:

  1. A 和 B 执行涉及状态 X 的交易 #1
  2. B 和 C 执行涉及状态 X 的交易 #2
  3. C 和 D 执行涉及状态 X 的交易 #3(监管者作为 FinalityFlow 中的额外参与者)

当监管机构运行下面的代码来查询其金库时,目的是只获取 tx #3,它实际上获取了所有 3 个 tx。无法区分 3 个 tx,只能过滤 tx #3。

val transactionsSnapshot = serviceHub.validatedTransactions.track().snapshot

有没有办法区分节点所涉及的交易、由于从某个节点广播而收到的交易以及由于广播而您也收到的属于链的一部分的交易。

随后,当 SGX 出现时,只有在来源期间为 validation/processing 接收的交易才会在安全飞地中,而节点参与并作为广播的一部分接收的交易存在于用于查询的保管库存储?

还没有直接完整地尝试过我将要提出的建议;但我已经实现了一些非常相似的东西......基于 VaultQueryCriteria 实现一个未来,它只观察参与者 C 和 D 的状态。在每次这样的更新中,检索交易(从节点已知的已验证交易列表)输出状态 = 从 VaultQueryCriteria 返回的状态。

可能有更巧妙的方法来做到这一点;但我基本上对我的要求采取了非常相似的方法......似乎工作令人满意。警告讲师:我对 V2.0 还不是很熟悉。

一点想法 - 希望对您有所帮助。

要广播一个交易,你可能有类似这样的东西 ReportToRegulatorFlow。但除此之外,在响应端你可以这样做

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

// Currently there's no way to distiguish transactions that are from a tx that was broadcasted versus ones from walking the chain and kept in storage
// We use memo/notes to keep track of this to differentiate during tx snapshot enquiry

serviceHub.vaultService.addNoteToTransaction(recorded.id, "BROADCASTED")

只查询广播的tx。

val transactionsSnapshot = serviceHub.validatedTransactions.track().snapshot
val broadcastedTx = transactionsSnapshot.filter{ serviceHub.vaultService.getTransactionNotes(it.tx.id).firstOrNull() == "BROADCASTED" }

只查询参与Tx。

val participatedTx = transactionsSnapshot.filter{ it.tx.requiredSigningKeys.any { resolveKey(it) != null && resolveKey(it) == ourIdentity} }