6 Transaction Reorderer - hyperledger-labs/orion-server GitHub Wiki
Transaction Reorderer
type transactionReorderer struct {
txQueue TransactionQueue
dependencyGraph DependencyGraph
treeBuilder TxMerkelTreeBuilder
nextTxBatchQueue NextTxBatchQueue
}
type dependencyGraph struct {
txWithNoInEdges []*transactionNode
reads map[string][]*transactionNode
writes map[string][]*transactionNode
}
type transactionNode struct {
txID string
inEdges []*transactionNode
outEdges []*transactionNode
}
type DependencyGraph interface {
AddTransaction(txs []*pb.Transaction) error
RemoveTransactions(txs []*pb.Transaction) error
TopologicalSort() []*pb.Transaction
GetTransactionsFromLevel(level int) []*pb.Transaction
}
type reorderedTransactionQueue struct {
queue [][]*pb.Transaction
merkleRoot []*pb.MerkleRoot
mu sync.RWMutex
}
type ReorderedTransactionQueue interface {
Enqueue(txs []*pb.Transaction, merkleRoot *pb.MerkleRoot) error
Dequeue() (txs []*pb.Transaction, *pb.MerkleRoot, error)
Size() uint64
}