This accessor does more that its name implies, as it attempts to create a peer if it doesn't exists which makes the API confusing. This was intended to be a test only method, but it sneaked outside of its original scope.
This diff removes getPeerId() and use registerProof() instead when this is the expected behavior. The original behavior is now enforced as test-only by moving it to the friend test class.
Ref T1854.