Skip to content

Commit daabd41

Browse files
committed
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}`.
1 parent c012875 commit daabd41

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/net.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,11 @@ static std::vector<CAddress> ConvertSeeds(const std::vector<uint8_t> &vSeedsIn)
208208
// one by discovery.
209209
CService GetLocalAddress(const CNetAddr& addrPeer)
210210
{
211-
CService ret{CNetAddr(), GetListenPort()};
212211
CService addr;
213212
if (GetLocal(addr, &addrPeer)) {
214-
ret = CService{addr};
213+
return addr;
215214
}
216-
return ret;
215+
return CService{CNetAddr(), GetListenPort()};
217216
}
218217

219218
static int GetnScore(const CService& addr)

0 commit comments

Comments
 (0)