Skip to content

Commit 68209a7

Browse files
committed
rpc: make addpeeraddress work with cjdns addresses
This allows us to add cjdns addresses to addrman for testing and debug purposes (if -cjdnsreachable is true)
1 parent a8a9ed6 commit 68209a7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/net.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ bool SeenLocal(const CService& addr);
164164
bool IsLocal(const CService& addr);
165165
bool GetLocal(CService &addr, const CNetAddr *paddrPeer = nullptr);
166166
CService GetLocalAddress(const CNetAddr& addrPeer);
167+
CService MaybeFlipIPv6toCJDNS(const CService& service);
167168

168169

169170
extern bool fDiscover;

src/rpc/net.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,8 @@ static RPCHelpMan addpeeraddress()
947947
bool success{false};
948948

949949
if (LookupHost(addr_string, net_addr, false)) {
950-
CAddress address{{net_addr, port}, ServiceFlags{NODE_NETWORK | NODE_WITNESS}};
950+
CService service{net_addr, port};
951+
CAddress address{MaybeFlipIPv6toCJDNS(service), ServiceFlags{NODE_NETWORK | NODE_WITNESS}};
951952
address.nTime = Now<NodeSeconds>();
952953
// The source address is set equal to the address. This is equivalent to the peer
953954
// announcing itself.

0 commit comments

Comments
 (0)