Check earlier for blocks with duplicate transactions to prevent DoS.
Port from Bitcoin be8651dde7b59e50e8c443da71c706667803d06d