Skip to content

Commit 89b2194

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25814: net: simplify GetLocalAddress()
daabd41 net: simplify GetLocalAddress() (Vasil Dimov) Pull request description: 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}`. ACKs for top commit: jarolrod: ACK daabd41 aureleoules: ACK daabd41. w0xlt: ACK bitcoin/bitcoin@daabd41 Tree-SHA512: 4bbd3746bc30fbc05bb32b58bb122c938acd849c0f72f1d3e8170557c1999ec26a888e06e874c3fc22562a2becddc7d817db7d174e0e1b383e8d74c39aa1e898
2 parents 27724c2 + daabd41 commit 89b2194

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)