When are blocks validated?

0

Are blocks validated just before they are stored to memory, upon receipt from an RPC submit call, or at some other time? Can you point to the place in code where this validation process begins? Is this process starting point the same for transactions?

JBaczuk

Posted 2018-07-07T14:10:49.017

Reputation: 6 172

Answers

0

Transactions are validated before they enter the mempool (see AcceptToMemoryPoolWorker(), and when they are submitted as a block.

Blocks are validated when a new one is received from a miner (see ProcessNewBlock(), and when they are synced from other peers (see ProcessMessage(), including on startup of a new full node.

JBaczuk

Posted 2018-07-07T14:10:49.017

Reputation: 6 172

0

I think you are talking about the consensus rules and when they are enforced...

To get the whole picture I would suggest to read about this topic in the book "Mastering Bitcoin" by Andreas Antonopoulos.

https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch10.asciidoc#decentralized-consensus

Querzel

Posted 2018-07-07T14:10:49.017

Reputation: 76