Avoid duplicating code for creating NetworkPeerInfo in the network config.
Avoid duplicating code for creating NetworkPeerInfo in the network config.

Closes: #2274
Approved by: davidiw

libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,libra/libra,libra/libra,aptos-labs/aptos-core,libra/libra,aptos-labs/aptos-core