Created
June 28, 2018 23:19
-
-
Save mgraczyk/f232228d84968cd1eda121502958afd8 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
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