1

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.

  • Neither of those functions are part of modern bitcoin core, try looking at some more recent source code to begin with. – Anonymous Oct 10 '18 at 13:09
  • main.cpp indicate that he's looking at severely outdated code, but miner.cpp is totally still a thing, as as AccepttoMemoryPool. – G. Maxwell Oct 12 '18 at 1:05
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).

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.