aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2022-08-10 15:09:29 +0200
committerVasil Dimov <vd@FreeBSD.org>2022-08-10 15:09:29 +0200
commitdaabd4121114fe6f780bccab311a522c0717c5b8 (patch)
tree38cc220b515a7ee2687bc5684fd307c770992b35 /src/net.cpp
parentc012875b9ded0a5183602f002738ca823d559518 (diff)
downloadbitcoin-daabd4121114fe6f780bccab311a522c0717c5b8.tar.xz
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}`.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp5
1 files changed, 2 insertions, 3 deletions
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<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)