wtxmgr: export dependencySort
This commit is contained in:
parent
fe56fdb828
commit
9b37298bad
2 changed files with 3 additions and 3 deletions
|
@ -83,9 +83,9 @@ func graphRoots(graph hashGraph) []*wire.MsgTx {
|
||||||
return roots
|
return roots
|
||||||
}
|
}
|
||||||
|
|
||||||
// dependencySort topologically sorts a set of transactions by their dependency
|
// DependencySort topologically sorts a set of transactions by their dependency
|
||||||
// order. It is implemented using Kahn's algorithm.
|
// order. It is implemented using Kahn's algorithm.
|
||||||
func dependencySort(txs map[chainhash.Hash]*wire.MsgTx) []*wire.MsgTx {
|
func DependencySort(txs map[chainhash.Hash]*wire.MsgTx) []*wire.MsgTx {
|
||||||
graph := makeGraph(txs)
|
graph := makeGraph(txs)
|
||||||
s := graphRoots(graph)
|
s := graphRoots(graph)
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ func (s *Store) UnminedTxs(ns walletdb.ReadBucket) ([]*wire.MsgTx, error) {
|
||||||
txSet[txHash] = &txRec.MsgTx
|
txSet[txHash] = &txRec.MsgTx
|
||||||
}
|
}
|
||||||
|
|
||||||
return dependencySort(txSet), nil
|
return DependencySort(txSet), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Store) unminedTxRecords(ns walletdb.ReadBucket) (map[chainhash.Hash]*TxRecord, error) {
|
func (s *Store) unminedTxRecords(ns walletdb.ReadBucket) (map[chainhash.Hash]*TxRecord, error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue