I wonder how the bitcoin protocol judge illegal transactions. As they say, the miner will look throughout the public ledger to make sure the transaction is alright. There are thousands of transactions in each block, if the miner has to check throughout the public ledger for each transaction, this would be very inefficient.
Every full node does this. That's why syncing takes forever. Yes, it's inefficient. But it's also the only way we know how to have such a system operate.