How does initial exchange of inventory work when both nodes have different chains?
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.