Skip to content

Instantly share code, notes, and snippets.

@mgraczyk
Created June 28, 2018 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgraczyk/f232228d84968cd1eda121502958afd8 to your computer and use it in GitHub Desktop.
Save mgraczyk/f232228d84968cd1eda121502958afd8 to your computer and use it in GitHub Desktop.
func (n *Node) IsAccepted(tx *Transaction) bool {
mutex.RLock()
defer mutex.RUnlock()
committed := false
for _, parent := range tx.Body.GetParents() {
parent := n.Transactions[parent]
committed = committed && n.IsAccepted(parent)
}
set := n.Conflicts[tx.Body.Utxo]
// [OT] safe early commitment.
committed = committed && len(set.Transactions) == 1
committed = committed && (n.Confidence(tx) > Beta1)
if !committed && set.Preferred == tx {
// [OT] consecutive counter
return set.Count > Beta2
}
return committed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment