Skip to content

Instantly share code, notes, and snippets.

@mgraczyk

mgraczyk/perlin9.go

Created Jun 28, 2018
Embed
What would you like to do?
// ... 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
You can’t perform that action at this time.