Submit Distribution List
After the nodes have done their off-chain duty and validated each others submissions, the next stage is the distribution stage; where a node is selected to generate and submit a distribution list on-chain.
generateDistributionList()
Following the submission of the list, other participating nodes audit it to ensure its validity; if the distribution list is valid, rewards are distributed among nodes.
In the code block above:
An empty distribution list is initialized
The task's data is retrieved using the
getTaskState
helper functionAll valid submissions are fetched from the task's data
The
submissions_audit_trigger
is also retrieved from the task's data; this object contains information about the audited submissionsIf
submissions
is null, an empty distribution list is returned. Else, the keys and values of thesubmissions
are grouped separately and in a loop, it calculates the audits on each submission and how many votes on the audit, and based on that it makes a decision.
submitDistributionList()
This function submits the distribution list generated by generateDistributionList()
to K2.
Last updated