DPoS in general has two parts
- Witness election process
- Block producing process
Witness election process
Unknown
Block producing process
If I am the producer
on_block_generating(block) {
broadcast(block);
add_block(block);
clear_canditates();
}
If I am the witness
on_block_message(block) {
if (!valid_block(block)) {
return;
}
if (!contain_irreversible_block(block)) {
return;
}
if (is_longest(block)) {
add_block(block);
clear_candidates();
cal_irreversible_block();
return;
}
if (same_length(block)) {
add_candidate(block);
}
}
Reference
EOS: Explanation of New BFT+DPoS w/ Daniel Larimer - Part 1 of 2
EOS: Explanation of New BFT+DPoS w/ Daniel Larimer - Part 2 of 2