Created
June 28, 2018 23:19
-
-
Save mgraczyk/3bd7e5bb8e91470b444acac6b60fe355 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... update the preference for ancestors | |
// [OT] This only loops over parents, not ancestors | |
for _, parentId := range tx.Body.Parents { | |
mutex.RLock() | |
parent := n.Transactions[parentId] | |
conflicts := n.Conflicts[parent.Body.Utxo] | |
mutex.RUnlock() | |
parentScore, presentScore := n.Confidence(parent), n.Confidence(conflicts.Preferred) | |
if parentScore > presentScore { | |
conflicts.Preferred = parent | |
} else if parent != conflicts.Last { | |
conflicts.Last = parent | |
conflicts.Count = 0 | |
} else { | |
conflicts.Count++ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment