Skip to content

Instantly share code, notes, and snippets.

@mgraczyk

mgraczyk/perlin8.go

Created Jun 28, 2018
Embed
What would you like to do?
func QueryEvents(n *Node, rpc RPC) {
// [OT] Line 2 with modified condition
for id, tx := range n.Unqueried() {
// [OT] Check that the transactions parents are known
// In a real implementation, undigestible txns
// would eventually need to be pruned.
if !n.IsDigestable(tx) {
continue
}
// [OT] Lines 4-5
positiveResponses, threshold := rpc.QueryNodesForTx(tx, K), Alpha*K
// [OT] Line 6 (does not match paper)
if positiveResponses < int(threshold) {
continue
}
// [OT] Line 7
mutex.Lock()
n.Chits[id] = 1
mutex.Unlock()
// ... Lines 8-15, update the preferences for ancestors
// ... Logging
// [OT] Line 17
mutex.Lock()
n.Queried[id] = tx
mutex.Unlock()
}
}
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.