PoW (or in fact any consensus algorithm) can't solve the Two Generals/Byzantine Generals Problem. It can only provide a very high and easily verifiable certainty of a transaction being correct.
A few assumptions are made:
- Most miners and node operators act either altruistic (true to the code no matter what comes) or economically egoistic (try to make as much money as possible). Purely destructive miners are a minority because it would not serve them a purpose.
- Network lag is negligible. It is assumed that no node will ever fall behind the chain, it will have received a block before the next one is mined.
Under these circumstances, the problem can be solved because all nodes agree on a common truth and nothing ever goes wrong. Here is why those assumptions are not necessarily always true:
- There might be an economic incentive for some miners to behave destructive and perform a 51% attack. Governments, big companies or investors who shorted a given cryptocurrency might have a benefit out of destroying it.
- Network lag is not negligible! The shorter the block time is, the higher the probability of two blocks being mined at the same time and therefore forking the chain. It is then the next block that makes on of the chains longer and therefore causes all of the non-destructive nodes to switch to the longer chain and therefore agreeing on a common truth again. That is why a transaction is not confirmed after only one block, there might always be a longer chain that your node doesn't know about yet. After a few blocks have been mined, it is highly likely that a transaction is correct and will never be changed.
The Two Generals problem can't be formally solved by modern consensus algorithms, but it can tremendously increase the likelihood of reaching consensus after a short time.