Skip to content

Commit

Permalink
rpc: make addpeeraddress work with cjdns addresses
Browse files Browse the repository at this point in the history
This allows us to add cjdns addresses to addrman for
testing and debug purposes (if -cjdnsreachable is true)
  • Loading branch information
mzumsande committed Sep 19, 2022
1 parent a8a9ed6 commit 68209a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ bool SeenLocal(const CService& addr);
bool IsLocal(const CService& addr);
bool GetLocal(CService &addr, const CNetAddr *paddrPeer = nullptr);
CService GetLocalAddress(const CNetAddr& addrPeer);
CService MaybeFlipIPv6toCJDNS(const CService& service);


extern bool fDiscover;
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,8 @@ static RPCHelpMan addpeeraddress()
bool success{false};

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

0 comments on commit 68209a7

Please sign in to comment.