2

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?

1 Answer 1

1

The way to do this is to validate each and every block before beginning work on the next block. If you validate the block you will have verified each and every transaction included in the block. This then gives you the knowledge you need to determine if particular transactions were included or not. When they have been included in a block they are also removed from the mempool. The process of first validating a block can be slow and is not always popular so many miners take shortcuts and mine using SPV (only the headers) they are thus unaware of which transactions are included in each block while validation is occurring so to keep miner busy they will mine a block without including any transactions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.