It is not strictly the longest chain that’s chosen, it’s the chain that has accrued essentially the most work (proof of labor).
The rationale miners cannot pretend the problem is that each node checks the problem of each new block. An attacker who faked this could by no means have the ability to spend the proceeds and would grow to be remoted from different nodes as a recognized unhealthy node.
Nodes that freshly joined do know the present problem. It’s easy to calculate, I believe you solely want verify a number of peer nodes to discover a comparatively small quantity of block-header knowledge from the blockchain. That takes little or no time.
The problem is adjusted each 2016 blocks based mostly on the time it took to search out the earlier 2016 blocks.
So, (hat tip to Murch for clarifying remark) as the problem solely adjustments each 2016 blocks and block headers include a timestamp and the problem goal, you simply want the headers of some blocks previous to the block being checked. This can be a tiny fraction of the ~650,000 blocks created thus far within the blockchain and so takes negligible effort in comparison with syncing an area copy of the total blockchain.
Even when newly joined nodes had been ignorant, the overwhelming majority of nodes usually are not newly joined and would end result within the faked block being fully ineffective and irrelevant as a consequence of being independently checked and rejected by nearly all nodes.
Miners are producing a sort of hash of a set of knowledge. The fastidiously chosen mathematical features make this hash extraordinarily costly and time-consuming to create however extraordinarily low cost and fast to confirm.