When two nodes connect to each other and exchange getblocks messages but they have different blockchains will both nodes download each others blockchain to verify which has higher chainwork or will they somehow exchange chainwork beforehand or something completely different?
They will exchange chainwork. The one that claims a lower chainwork will query the other to confirm that its claim for a higher chainwork is legitimate. If it can confirm the claim, then it will switch to the chain with the higher total work.
-
1