mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 22:24:05 +01:00
rpc: Add listen address to incoming connections in getpeerinfo
This adds the listening address on which incoming connections were received to the CNode and CNodeStats structures. The address is reported in `getpeerinfo`. This can be useful for distinguishing connections received on different listening ports (e.g. when using a different listening port for Tor hidden service connections) or different networks.
This commit is contained in:
@@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(DoS_banning)
|
||||
|
||||
connman->ClearBanned();
|
||||
CAddress addr1(ip(0xa0b0c001), NODE_NONE);
|
||||
CNode dummyNode1(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr1, 0, 0, "", true);
|
||||
CNode dummyNode1(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr1, 0, 0, CAddress(), "", true);
|
||||
dummyNode1.SetSendVersion(PROTOCOL_VERSION);
|
||||
GetNodeSignals().InitializeNode(&dummyNode1, *connman);
|
||||
dummyNode1.nVersion = 1;
|
||||
@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(DoS_banning)
|
||||
BOOST_CHECK(!connman->IsBanned(ip(0xa0b0c001|0x0000ff00))); // Different IP, not banned
|
||||
|
||||
CAddress addr2(ip(0xa0b0c002), NODE_NONE);
|
||||
CNode dummyNode2(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr2, 1, 1, "", true);
|
||||
CNode dummyNode2(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr2, 1, 1, CAddress(), "", true);
|
||||
dummyNode2.SetSendVersion(PROTOCOL_VERSION);
|
||||
GetNodeSignals().InitializeNode(&dummyNode2, *connman);
|
||||
dummyNode2.nVersion = 1;
|
||||
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
|
||||
connman->ClearBanned();
|
||||
ForceSetArg("-banscore", "111"); // because 11 is my favorite number
|
||||
CAddress addr1(ip(0xa0b0c001), NODE_NONE);
|
||||
CNode dummyNode1(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr1, 3, 1, "", true);
|
||||
CNode dummyNode1(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr1, 3, 1, CAddress(), "", true);
|
||||
dummyNode1.SetSendVersion(PROTOCOL_VERSION);
|
||||
GetNodeSignals().InitializeNode(&dummyNode1, *connman);
|
||||
dummyNode1.nVersion = 1;
|
||||
@@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
|
||||
SetMockTime(nStartTime); // Overrides future calls to GetTime()
|
||||
|
||||
CAddress addr(ip(0xa0b0c001), NODE_NONE);
|
||||
CNode dummyNode(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr, 4, 4, "", true);
|
||||
CNode dummyNode(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr, 4, 4, CAddress(), "", true);
|
||||
dummyNode.SetSendVersion(PROTOCOL_VERSION);
|
||||
GetNodeSignals().InitializeNode(&dummyNode, *connman);
|
||||
dummyNode.nVersion = 1;
|
||||
|
||||
Reference in New Issue
Block a user