There is a mention of a fork database in the docs for the bnet_plugin. Could you please tell me what the fork database is and how is it related to the state of the nodeos node?
From the code:
/** * @class fork_database * @brief manages light-weight state for all potential unconfirmed forks * * As new blocks are received, they are pushed into the fork database. The fork * database tracks the longest chain and the last irreversible block number. All * blocks older than the last irreversible block are freed after emitting the * irreversible signal. */
and from the whitepaper:
Under normal conditions a DPOS blockchain does not experience any forks because, rather than compete, the block producers cooperate to produce blocks. In the event there is a fork, consensus will automatically switch to the longest chain. This method works because the rate at which blocks are added to a blockchain fork is directly correlated to the percentage of block producers that share the same consensus. In other words, a blockchain fork with more producers on it will grow in length faster than one with fewer producers, because the fork with more producers will experience fewer missed blocks.
Furthermore, no block producer should be producing blocks on two forks at the same time. A block producer caught doing this will likely be voted out. Cryptographic evidence of such double-production may also be used to automatically remove abusers.
Thus, my understanding is that the "fork database" represents the chain of blocks that a producer keeps track of that are not yet irreversible but are considered the longest chain according to the view of that BP.