From daabd4121114fe6f780bccab311a522c0717c5b8 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 10 Aug 2022 15:09:29 +0200 Subject: 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}`. --- src/net.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/net.cpp') diff --git a/src/net.cpp b/src/net.cpp index e87ac079b5..865ce2ea97 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -208,12 +208,11 @@ static std::vector ConvertSeeds(const std::vector &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) -- cgit v1.2.3