mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
core: Make topological sort result deterministic
This commit is contained in:
parent
5596ced5c3
commit
8e6198cf91
@ -39,7 +39,8 @@ class ResolveTransactionsProtocol(private val txHashes: Set<SecureHash>,
|
||||
val forwardGraph = HashMap<SecureHash, HashSet<SignedTransaction>>()
|
||||
transactions.forEach { tx ->
|
||||
tx.tx.inputs.forEach { input ->
|
||||
forwardGraph.getOrPut(input.txhash) { HashSet() }.add(tx)
|
||||
// Note that we use a LinkedHashSet here to make the traversal deterministic (as long as the input list is)
|
||||
forwardGraph.getOrPut(input.txhash) { LinkedHashSet() }.add(tx)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user