Except for checking for double spends, if there's a transaction in a block that's already in the node's mempool, it can theoretically skip its validation. Does it actually happen, or the nodes validate each transaction twice?


The most expensive part of checking a transaction, ECDSA validation, is cached.

  • Didn't cache also the transaction itself?
    – Osias Jota
    Mar 23 '18 at 12:38
  • 1
    Transaction validity can change (OP_CLTV).
    – Claris
    Mar 23 '18 at 12:54
  • Now I'm thinking about it, it can change even before that because there could've been a double spend attempt.
    – Osias Jota
    Mar 23 '18 at 15:16

Zero confirmed transaction are unsafe. Simillarly, it is not safe to validate using them as benchmark. See this example:

  • You have a transaction T1 that spends txouts of transaction T in mempool
  • Another transaction T2 in mempool spends outputs of T1
  • In Block B
    • We have tranaction T1' that is double spend of T1 with different output. This is possible since miner can directly include T1' in the block and it is valid.
    • We also have T2 in B but it is invalid. Now validating T2 based on mempool would be wrong. We have to consider all previous outputs and outputs in the current block.

Also note that bitcoind has to validate blocks which on different forks/chains. Mempool only has unconfirmed transaction on the longest chain

  • 1
    Nonsense, you can cache the validation, just not the UTXO check.
    – Claris
    Mar 23 '18 at 13:25

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.