<p>Transactions are validated before they enter the mempool (see <a href="https://github.com/bitcoin/bitcoin/blob/v0.16.2/src/validation.cpp#L550" rel="nofollow noreferrer">AcceptToMemoryPoolWorker()</a>, and when they are submitted as a block.</p>

<p>Blocks are validated when a new one is received from a miner (see <a href="https://github.com/bitcoin/bitcoin/blob/v0.16.2/src/validation.cpp#L3431" rel="nofollow noreferrer">ProcessNewBlock()</a>, and when they are synced from other peers (see <a href="https://github.com/bitcoin/bitcoin/blob/v0.16.2/src/net_processing.cpp#L1493" rel="nofollow noreferrer">ProcessMessage()</a>, including on startup of a new full node.</p>

CC BY-SA 4.0
2018-08-29T18:41:18.100Z
2018-08-29T18:41:18.100Z
JBaczuk
<p>I think you are talking about the consensus rules and when they are enforced... </p>

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

<p><a href="https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch10.asciidoc#decentralized-consensus" rel="nofollow noreferrer">https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch10.asciidoc#decentralized-consensus</a></p>

CC BY-SA 4.0
2018-07-07T17:22:35.883Z
2018-07-07T17:22:35.883Z
Querzel
<p>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?</p>

<block><validation><source-code>
When are blocks validated?
JBaczuk
# When are blocks validated?

(Asked by: username_0 on 2018-07-07)

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?

**Tags:** block, validation, source-code


---

## 2 answers

### Answer by username_0 on 2018-08-29. Score: 0 | Accepted answer

Transactions are validated before they enter the mempool (see [AcceptToMemoryPoolWorker()](https://github.com/bitcoin/bitcoin/blob/v0.16.2/src/validation.cpp#L550), and when they are submitted as a block.

Blocks are validated when a new one is received from a miner (see [ProcessNewBlock()](https://github.com/bitcoin/bitcoin/blob/v0.16.2/src/validation.cpp#L3431), and when they are synced from other peers (see [ProcessMessage()](https://github.com/bitcoin/bitcoin/blob/v0.16.2/src/net_processing.cpp#L1493), including on startup of a new full node.


---

### Answer by username_1 on 2018-07-07. Score: 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>


---

