wtxmgr: export dependencySort

This commit is contained in:
Wilmer Paulino 2019-01-31 16:42:53 -08:00
parent fe56fdb828
commit 9b37298bad
No known key found for this signature in database
GPG key ID: 6DF57B9F9514972F
2 changed files with 3 additions and 3 deletions

View file

@ -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)

View file

@ -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) {