I am trying to fully understand the block chain algorithm and in particular, the consensus.
My understanding is each miner has a pool of pending events -- events that have not yet been included in a block --.
What I can't get my head around is if I'm busy mining events A, B & C into a block. Then in the mean time, a new block arrives that already includes event A, and its chain represent the "most work chain". I should abandon my effort to mine and start mining again after this new block.
If that's the case, then when I restart mining, my pending events should only have B and C. That I understand.
But if the new block that now becomes the head of the block chain was not parented by my current main block, that means that I could duplicate event B & C (if the parent of the new block contained them).
So how do I need to manage pending events? Do I need to go back the new chain to make sure I don't make duplicates?