factomd major process flow

Secured
#1
First of all, I'd like to apologize to everyone that has to look at this enormous, messy diagram.

Now that that's out of the way, it's time for my second publication: an attempt at a broad look at the processes running in the factomd node. It's the result of several days of reading the source code and trying to follow all the branches it leads to. It ended up being much bigger than anticipated and still doesn't cover everything. The most glaring hole are the actual network messages, which dictate the consensus algorithm and elections. They're often polymorphic or heavily branching, so it was hard to fit into this type of diagram. I plan on doing separate diagrams covering those, if it's feasible.

The goal wasn't to create an all-encompassing document that describes every aspect of the code but a "red line" that someone can follow alongside reading the code. Some way of turning the pages of notes I made into something that others can use.

Legend:
Black lines indicate regular program flow
Red lines indicate that a Goroutine is created
Olive lines indicate a loop of some sort (if there are both black and olive lines, black ones are when the loop termination condition is reached)
Circles with an X indicate Goroutine/process termination
Clouds are elements that are highly complex and are represented separately further down, or are not part of this chart (particularly the clouds in the "ValidatorLoop" are where an enormous chunk of program logic happens but it would take me another week to include those)
The blue boxes are some of the message types that are involved or sent out

Here's the full chart, as image:
process-flow-rc1.png

(warning: it's very big)

Direct link: https://factomize.com/forums/attachments/process-flow-rc1-png.966/

I used https://www.draw.io/ to create it. To view the original, you can view it here.

As before, this is not guaranteed to be accurate, but I did my best to interpret the code correctly. Any corrections are welcome.
 
Secured
#3
Did you do this all by hand?
Yes, took me a couple of days and it was a three step process.

1. Read code until it halfway starts to make sense
2. Follow the bootup process, look at (almost) every function to see what it does. Try to understand it, take notes (taking notes was really important)
3. Create the graphic by going over the code a third time and comparing it to notes
 
Secured
#4
This is really impressive. I tried to do something similar to this back in mid-2017, and it was a lot more challenging than I had guessed it would be, and yours is significantly more thorough than anything I ever produced. Good job.

When I get some free time I'll do a deep-dive and see if there's any more substantive feedback that might be worth providing. For right now, all I have to say is thanks for doing this.