sample_chain/order/core/reordering.go

20 lines
374 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package core
// TxReorder 交易重排序
// 输入txId 交易ID g 交易分组情况
// 输出bool 交易是否需要提前中止
func TxReorder(txId string, g *TransactionGroup) bool {
num := g.Rely[txId]
if g.Group[num] != nil {
cg := CreateConflictGraph(g.Group[num])
cg.TopologicalSort()
if cg.HasLoop == true {
return true
}
}
return false
}