<p>Your general understanding is correct.</p>

<p>Mining doesn't perform any additional checks then any other full node.  Mining serves the function of giving transactions an ordering which is difficult to undo, but validation is just a function performed by every node.</p>

<p>Some tests are in miner.cpp because creating a block that matches some set of rules needs different code than checking if a block matches those rules. For example, some space needs to be set aside for the coinbase transaction (which is produced externally in normal use).</p>

CC BY-SA 4.0
2018-10-12T01:04:42.110Z
2018-10-12T01:04:42.110Z
G. Maxwell
<p>I understand that consensus (mining) and transaction validation are different concepts. Correct me if I'm wrong, but I believe each full node validates transactions and puts the valid ones into its own memory pool. Miners select transactions from the mempool and carry out the mining/consensus process to create a block.</p>

<p>Are there additional checks carried out by miners? If so, where are they in the Bitcoin source code? So far, I've found that transaction validation is carried out by some functions in main.cpp like AccepttoMemoryPool, while mining is implemented in miner.cpp. However, miner.cpp apparently also contains some checks.</p>

CC BY-SA 4.0
2018-10-10T13:09:16.297Z
Neither of those functions are part of modern bitcoin core, try looking at some more recent source code to begin with.
Claris
CC BY-SA 4.0
2018-10-12T01:05:26.093Z
main.cpp indicate that he's looking at severely outdated code, but miner.cpp is totally still a thing, as as AccepttoMemoryPool.
G. Maxwell
<mining-theory><validation><source-code>
Where in the source code are transaction validation checks implemented?
sk4
# Where in the source code are transaction validation checks implemented?

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

I understand that consensus (mining) and transaction validation are different concepts. Correct me if I'm wrong, but I believe each full node validates transactions and puts the valid ones into its own memory pool. Miners select transactions from the mempool and carry out the mining/consensus process to create a block.

Are there additional checks carried out by miners? If so, where are they in the Bitcoin source code? So far, I've found that transaction validation is carried out by some functions in main.cpp like AccepttoMemoryPool, while mining is implemented in miner.cpp. However, miner.cpp apparently also contains some checks.

**Tags:** mining-theory, validation, source-code

> **Comments:**
> **username_1**: Neither of those functions are part of modern bitcoin core, try looking at some more recent source code to begin with.  
> **username_2**: main.cpp indicate that he's looking at severely outdated code, but miner.cpp is totally still a thing, as as AccepttoMemoryPool.  

---

## 1 answers

### Answer by username_2 on 2018-10-12. Score: 1

Your general understanding is correct.

Mining doesn't perform any additional checks then any other full node. Mining serves the function of giving transactions an ordering which is difficult to undo, but validation is just a function performed by every node.

Some tests are in miner.cpp because creating a block that matches some set of rules needs different code than checking if a block matches those rules. For example, some space needs to be set aside for the coinbase transaction (which is produced externally in normal use).


---

