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