net: simplify GetLocalAddress()

There is no need to use two variables `ret` and `addr` of the same type
`CService` and assign one to the other in a strange way like
`ret = CService{addr}`.
This commit is contained in:
Vasil Dimov 2022-08-10 15:09:29 +02:00
parent c012875b9d
commit daabd41211
No known key found for this signature in database
GPG Key ID: 54DF06F64B55CBBF

View File

@ -208,12 +208,11 @@ static std::vector<CAddress> ConvertSeeds(const std::vector<uint8_t> &vSeedsIn)
// one by discovery.
CService GetLocalAddress(const CNetAddr& addrPeer)
{
CService ret{CNetAddr(), GetListenPort()};
CService addr;
if (GetLocal(addr, &addrPeer)) {
ret = CService{addr};
return addr;
}
return ret;
return CService{CNetAddr(), GetListenPort()};
}
static int GetnScore(const CService& addr)