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)
This commit is contained in:
1 parent
a8a9ed67cc
commit
68209a7b5c
2 files changed
+3
-1
No files matched your search
@@ -164,6 +164,7 @@ bool SeenLocal(const CService& addr);
|
|||||||
bool IsLocal(const CService& addr);
|
bool IsLocal(const CService& addr);
|
||||||
bool GetLocal(CService &addr, const CNetAddr *paddrPeer = nullptr);
|
bool GetLocal(CService &addr, const CNetAddr *paddrPeer = nullptr);
|
||||||
CService GetLocalAddress(const CNetAddr& addrPeer);
|
CService GetLocalAddress(const CNetAddr& addrPeer);
|
||||||
|
CService MaybeFlipIPv6toCJDNS(const CService& service);
|
||||||
|
|
||||||
|
|
||||||
extern bool fDiscover;
|
extern bool fDiscover;
|
||||||
|
|||||||
+2
-1
@@ -947,7 +947,8 @@ static RPCHelpMan addpeeraddress()
|
|||||||
bool success{false};
|
bool success{false};
|
||||||
|
|
||||||
if (LookupHost(addr_string, net_addr, 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>();
|
address.nTime = Now<NodeSeconds>();
|
||||||
// The source address is set equal to the address. This is equivalent to the peer
|
// The source address is set equal to the address. This is equivalent to the peer
|
||||||
// announcing itself.
|
// announcing itself.
|
||||||
|
|||||||
Reference in new issue
Block a user