-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: cover addrv2 anchors by adding TorV3 to CAddress in messages.py #27452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Did you take a look at #27295? |
I will now! |
6211a31
to
f06f28a
Compare
test/functional/feature_anchors.py
Outdated
|
||
self.log.info("Check peer info") | ||
peer_info = self.nodes[0].getpeerinfo() | ||
assert len(peer_info) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could use assert_equal
here and in the other similar cases
assert len(peer_info) == 1 | |
assert_equal(len(peer_info), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
This comment was marked as spam.
This comment was marked as spam.
f06f28a
to
076a36e
Compare
076a36e
to
210d57c
Compare
Thanks for the review Will, nits addressed and pushed |
Concept ACK, I guess we can forget about Torv2 and completely drop support about it from everywhere as if it never existed. The Tor network does not support those anymore. |
test/functional/feature_anchors.py
Outdated
onion_conf = Socks5Configuration() | ||
onion_conf.auth = True | ||
onion_conf.unauth = True | ||
onion_conf.addr = ('127.0.0.1', 10000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could collide with another port randomly assigned by the testing framework (even if it looks like that it currently cannot, it may do in the future) and also could collide with another instance of this test run in parallel on the same machine. Better use p2p_port()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, fixed.
test/functional/feature_anchors.py
Outdated
with open(node_anchors_path, "wb") as file_handler: | ||
# Cheat: modify service flags for this address | ||
# even though we never connected to it | ||
new_data = bytearray(data)[:-32] | ||
new_data[services_index] = P2P_SERVICES | ||
new_data_hash = hash256(new_data) | ||
file_handler.write(new_data + new_data_hash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it necessary to modify the services?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't attempt an anchor connection to a host that doesn't have services:
Line 1813 in b22408d
!HasAllDesirableServiceFlags(addr.nServices) || |
In the test we don't actually bother setting up a listening node at the onion address we connect to with block-relay-only
so the services remain null, even though we do still write the host information to anchors.dat
I use this hack to ensure that we attempt a connection, and the last assertion in the test will fail without it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful to explain this in the test.
4a1fb18
to
0a10285
Compare
Concept ACK. Did you plan to drop the Tor v2 additions here? (No need to add code that we'll just remove.) As mentioned in #27295 (review), I'm not sure how this was coordinated with that pull, and these changes could possibly be split into preparatory changes (insofar as they don't break any tests) and implementation commits. |
0a10285
to
455f8c4
Compare
455f8c4
to
b5e0398
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach ACK b5e0398
assert self.net in (self.NET_IPV4, self.NET_IPV6, | ||
self.NET_I2P, self.NET_CJDNS, | ||
self.NET_TORV3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this use self.ADDRV2_NET_NAME
?
assert self.net in (self.NET_IPV4, self.NET_IPV6, | |
self.NET_I2P, self.NET_CJDNS, | |
self.NET_TORV3) | |
assert self.net in self.ADDRV2_NET_NAME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes thanks
self.conn.close() | ||
if not self.serv.keep_alive: | ||
self.conn.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would this socket be closed if keep_alive
is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I'm just letting it drop out of scope at the end of the test, but looking into it more it may actually be staying alive until the entire test runner exits.
Should I add a manual close function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update: no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update update: manually calling onion_proxy.close()
in the test now with a comment
test/functional/p2p_addrv2_relay.py
Outdated
else: | ||
addr.ip = f"123.123.123.{i % 256}" | ||
addr.port = 8333 + i | ||
msg_size += addr.ADDRV2_ADDRESS_LENGTH[addr.NET_IPV4] | ||
msg_size += 4 + 1 + 1 + 2 + 1 # time, services, networkID, port, address length byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The port is serialized last, but in the comment is comes after networkID
. Would it be better to calculate the message size separately, given an array of addresses as input?
[patch] calculate addrv2 message size separately
diff --git i/test/functional/p2p_addrv2_relay.py w/test/functional/p2p_addrv2_relay.py
index 23d7c94fd0..f9a8c44be2 100755
--- i/test/functional/p2p_addrv2_relay.py
+++ w/test/functional/p2p_addrv2_relay.py
@@ -20,32 +20,27 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
I2P_ADDR = "c4gfnttsuwqomiygupdqqqyy5y5emnk5c73hrfvatri67prd7vyq.b32.i2p"
ONION_ADDR = "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion"
ADDRS = []
-msg_size = 1 # vector length byte
for i in range(10):
addr = CAddress()
addr.time = int(time.time()) + i
addr.port = 8333 + i
addr.nServices = P2P_SERVICES
# Add one I2P and one onion V3 address at an arbitrary position.
if i == 5:
addr.net = addr.NET_I2P
addr.ip = I2P_ADDR
addr.port = 0
- msg_size += addr.ADDRV2_ADDRESS_LENGTH[addr.NET_I2P]
elif i == 8:
addr.net = addr.NET_TORV3
addr.ip = ONION_ADDR
- msg_size += addr.ADDRV2_ADDRESS_LENGTH[addr.NET_TORV3]
else:
addr.ip = f"123.123.123.{i % 256}"
- msg_size += addr.ADDRV2_ADDRESS_LENGTH[addr.NET_IPV4]
- msg_size += 4 + 1 + 1 + 2 + 1 # time, services, networkID, port, address length byte
ADDRS.append(addr)
class AddrReceiver(P2PInterface):
addrv2_received_and_checked = False
@@ -59,12 +54,23 @@ class AddrReceiver(P2PInterface):
self.addrv2_received_and_checked = True
def wait_for_addrv2(self):
self.wait_until(lambda: "addrv2" in self.last_message)
+def calc_addrv2_msg_size(addrs):
+ size = 1 # vector length byte
+ for addr in addrs:
+ size += 4 # time
+ size += 1 # services, COMPACTSIZE(P2P_SERVICES)
+ size += 1 # network id
+ size += 1 # address length byte
+ size += addr.ADDRV2_ADDRESS_LENGTH[addr.net] # address
+ size += 2 # port
+ return size
+
class AddrTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [["-whitelist=addr@127.0.0.1"]]
@@ -78,12 +84,13 @@ class AddrTest(BitcoinTestFramework):
with self.nodes[0].assert_debug_log(['addrv2 message size = 1010']):
addr_source.send_and_ping(msg)
self.log.info('Check that addrv2 message content is relayed and added to addrman')
addr_receiver = self.nodes[0].add_p2p_connection(AddrReceiver())
msg.addrs = ADDRS
+ msg_size = calc_addrv2_msg_size(ADDRS)
with self.nodes[0].assert_debug_log([
f'received: addrv2 ({msg_size} bytes) peer=0',
f'sending addrv2 ({msg_size} bytes) peer=1',
]):
addr_source.send_and_ping(msg)
self.nodes[0].setmocktime(int(time.time()) + 30 * 60)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fantastic, thanks for the patch
test/functional/feature_anchors.py
Outdated
self.restart_node(0, extra_args=[f"-onion={onion_conf.addr[0]}:{onion_conf.addr[1]}"]) | ||
|
||
self.log.info(f"Add 256-bit-address block-relay-only connections to node") | ||
ONION_ADDR = "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion:8333" | ||
self.nodes[0].addconnection(ONION_ADDR, 'block-relay-only') | ||
|
||
self.log.info("Check peer info") | ||
peer_info = self.nodes[0].getpeerinfo() | ||
assert_equal(len(peer_info), 1) | ||
assert_equal(peer_info[0]["network"], "onion") | ||
assert_equal(peer_info[0]["connection_type"], "block-relay-only") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this suffice to ensure 1 block-only was opened:
[patch] check log at shutdown
diff --git i/test/functional/feature_anchors.py w/test/functional/feature_anchors.py
index e7cd642484..327533a340 100755
--- i/test/functional/feature_anchors.py
+++ w/test/functional/feature_anchors.py
@@ -91,29 +91,23 @@ class AnchorsTest(BitcoinTestFramework):
self.log.info("Ensure addrv2 support")
# Use proxies to catch outbound connections to networks with 256-bit addresses
onion_conf = Socks5Configuration()
onion_conf.auth = True
onion_conf.unauth = True
onion_conf.addr = ('127.0.0.1', p2p_port(self.num_nodes))
- onion_conf.keep_alive = True
onion_proxy = Socks5Server(onion_conf)
onion_proxy.start()
self.restart_node(0, extra_args=[f"-onion={onion_conf.addr[0]}:{onion_conf.addr[1]}"])
self.log.info(f"Add 256-bit-address block-relay-only connections to node")
ONION_ADDR = "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion:8333"
self.nodes[0].addconnection(ONION_ADDR, 'block-relay-only')
- self.log.info("Check peer info")
- peer_info = self.nodes[0].getpeerinfo()
- assert_equal(len(peer_info), 1)
- assert_equal(peer_info[0]["network"], "onion")
- assert_equal(peer_info[0]["connection_type"], "block-relay-only")
-
self.log.info("Stop node 0")
- self.stop_node(0)
+ with self.nodes[0].assert_debug_log([f"DumpAnchors: Flush 1 outbound block-relay-only peer addresses to anchors.dat"]):
+ self.stop_node(0)
self.log.info("Check for addrv2 addresses in anchors.dat")
caddr = CAddress()
caddr.net = CAddress.NET_TORV3
[caddr.ip, port_str] = ONION_ADDR.split(":")
caddr.port = int(port_str)
If "yes", then no need for keep_alive
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sweet! awesome, i'll remove the socks5.py commit and apply this instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://cirrus-ci.com/task/5531648075235328?logs=ci#L4421
Actually there is still a race condition there. I think the keep_alive is necessary for bitcoind to even acknowledge the blocks only peer exists. We can use debug log or getpeerinfo but seems like either way the socks proxy is closing too soon
b5e0398
to
991a478
Compare
self.nodes[0].addconnection(ONION_ADDR, 'block-relay-only') | ||
|
||
self.log.info("Stop node 0") | ||
with self.nodes[0].assert_debug_log([f"DumpAnchors: Flush 1 outbound block-relay-only peer addresses to anchors.dat"]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failing at this line.
https://cirrus-ci.com/task/5531648075235328?logs=ci#L3397
https://cirrus-ci.com/task/5531648075235328?logs=ci#L4424
Expected messages "['DumpAnchors: Flush 1 outbound block-relay-only peer addresses to anchors.dat']" does not partially match log:
- 2023-07-05T18:23:01.237732Z [shutoff] [logging/timer.h:56] [Log] DumpAnchors: Flush 0 outbound block-relay-only peer addresses to anchors.dat started
- 2023-07-05T18:23:01.286842Z [shutoff] [logging/timer.h:56] [Log] DumpAnchors: Flush 0 outbound block-relay-only peer addresses to anchors.dat completed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reproduced this test failure locally on the 4th run of test/functional/feature_anchors.py
(arm64 macOS 13.4.1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed :-( see #27452 (comment) unless @vasild disagrees I'll revert part of my last update and put keep_alive
back in socks5.py
991a478
to
805692f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested Approach ACK
test/functional/test_runner.py
Outdated
@@ -80,6 +80,7 @@ | |||
"ripemd160", | |||
"script", | |||
"segwit_addr", | |||
"messages" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested diff
@@ -76,11 +76,11 @@ TEST_FRAMEWORK_MODULES = [
"blocktools",
"ellswift",
"key",
+ "messages",
"muhash",
"ripemd160",
"script",
"segwit_addr",
- "messages"
]
(Also, project convention is to leave a comma after the last element, to minimize the diff in future changes)
@@ -1852,3 +1887,23 @@ def serialize(self): | |||
def __repr__(self): | |||
return "msg_sendtxrcncl(version=%lu, salt=%lu)" %\ | |||
(self.version, self.salt) | |||
|
|||
class TestFrameworkScript(unittest.TestCase): | |||
def test_addrv2encodedecode(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f6bd653 naming, this would be more readable in case of a test failure (also, remove 2 extra LF at EOF)
diff
class TestFrameworkScript(unittest.TestCase):
- def test_addrv2encodedecode(self):
+ def test_addrv2_encode_decode(self):
def check_addrv2(ip, net):
@@ -1905,5 +1905,3 @@ class TestFrameworkScript(unittest.TestCase):
check_addrv2("fc32:17ea:e415:c3bf:9808:149d:b5a2:c9aa", CAddress.NET_CJDNS)
-
-
Running Unit Tests for Test Framework Modules
................E
======================================================================
ERROR: test_addrv2_encode_decode (test_framework.messages.TestFrameworkScript.test_addrv2_encode_decode)
----------------------------------------------------------------------
actual = CAddress() | ||
actual.deserialize_v2(BytesIO(ser)) | ||
self.assertEqual(actual.ip, ip) | ||
self.assertEqual(actual.net, net) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f6bd653 nit, can be simplified
diff
def check_addrv2(ip, net):
addr = CAddress()
- addr.net = net
- addr.ip = ip
+ addr.net, addr.ip = net, ip
ser = addr.serialize_v2()
actual = CAddress()
actual.deserialize_v2(BytesIO(ser))
- self.assertEqual(actual.ip, ip)
- self.assertEqual(actual.net, net)
+ self.assertEqual(actual, addr)
|
||
self.log.info("Restarting node attempts to reconnect to anchors") | ||
with self.nodes[0].assert_debug_log([f"Trying to make an anchor connection to {ONION_ADDR}"]): | ||
self.start_node(0, extra_args=[f"-onion={onion_conf.addr[0]}:{onion_conf.addr[1]}"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various suggestions
diff --git a/test/functional/feature_anchors.py b/test/functional/feature_anchors.py
index 6c97eed9d86..87c6082b3e0 100755
--- a/test/functional/feature_anchors.py
+++ b/test/functional/feature_anchors.py
@@ -14,6 +14,7 @@ from test_framework.util import check_node_connections, assert_equal, p2p_port
INBOUND_CONNECTIONS = 5
BLOCK_RELAY_CONNECTIONS = 2
+ONION_ADDR = "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion:8333"
class AnchorsTest(BitcoinTestFramework):
@@ -56,7 +57,7 @@ class AnchorsTest(BitcoinTestFramework):
else:
inbound_nodes_port.append(hex(int(addr_split[1]))[2:])
- self.log.info("Stop node 0")
+ self.log.debug("Stop node")
self.stop_node(0)
# It should contain only the block-relay-only addresses
@@ -80,7 +81,7 @@ class AnchorsTest(BitcoinTestFramework):
tweaked_contents[20:20] = b'1'
out_file_handler.write(bytes(tweaked_contents))
- self.log.info("Start node")
+ self.log.debug("Start node")
self.start_node(0)
self.log.info("When node starts, check if anchors.dat doesn't exist anymore")
@@ -97,11 +98,9 @@ class AnchorsTest(BitcoinTestFramework):
onion_proxy.start()
self.restart_node(0, extra_args=[f"-onion={onion_conf.addr[0]}:{onion_conf.addr[1]}"])
- self.log.info(f"Add 256-bit-address block-relay-only connections to node")
- ONION_ADDR = "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion:8333"
+ self.log.info("Add 256-bit-address block-relay-only connection to node")
self.nodes[0].addconnection(ONION_ADDR, 'block-relay-only')
-
- self.log.info("Stop node 0")
+ self.log.debug("Stop node")
with self.nodes[0].assert_debug_log([f"DumpAnchors: Flush 1 outbound block-relay-only peer addresses to anchors.dat"]):
self.stop_node(0)
# Manually close keep_alive proxy connection
@@ -110,7 +109,7 @@ class AnchorsTest(BitcoinTestFramework):
self.log.info("Check for addrv2 addresses in anchors.dat")
caddr = CAddress()
caddr.net = CAddress.NET_TORV3
- [caddr.ip, port_str] = ONION_ADDR.split(":")
+ caddr.ip, port_str = ONION_ADDR.split(":")
caddr.port = int(port_str)
# TorV3 addrv2 serialization:
# time(4) | services(1) | networkID(1) | address length(1) | address(32)
@@ -122,7 +121,7 @@ class AnchorsTest(BitcoinTestFramework):
data = bytes()
with open(node_anchors_path, "rb") as file_handler:
data = file_handler.read()
- assert_equal(data[services_index], 0x00) # services == NONE
+ assert_equal(data[services_index], 0x00) # services == NONE
anchors2 = data.hex()
assert expected_pubkey in anchors2
@@ -138,5 +138,6 @@ class AnchorsTest(BitcoinTestFramework):
with self.nodes[0].assert_debug_log([f"Trying to make an anchor connection to {ONION_ADDR}"]):
self.start_node(0, extra_args=[f"-onion={onion_conf.addr[0]}:{onion_conf.addr[1]}"])
+
if __name__ == "__main__":
AnchorsTest().main()
--- a/test/functional/test_framework/socks5.py
+++ b/test/functional/test_framework/socks5.py
@@ -116,7 +116,7 @@ class Socks5Connection():
cmdin = Socks5Command(cmd, atyp, addr, port, username, password)
self.serv.queue.put(cmdin)
- logger.info('Proxy: %s', cmdin)
+ logger.debug('Proxy: %s', cmdin)
# Fall through to disconnect
except Exception as e:
logger.exception("socks5 request handling failed.")
@@ -160,4 +160,3 @@ class Socks5Server():
s.connect(self.conf.addr)
s.close()
self.thread.join()
-
(the newline changes are on purpose)
test/functional/feature_anchors.py
Outdated
with open(node_anchors_path, "wb") as file_handler: | ||
# Cheat: modify service flags for this address | ||
# even though we never connected to it | ||
new_data = bytearray(data)[:-32] | ||
new_data[services_index] = P2P_SERVICES | ||
new_data_hash = hash256(new_data) | ||
file_handler.write(new_data + new_data_hash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful to explain this in the test.
Also removes TorV2 from messages.py See bitcoin#22050 Co-authored-by: Matthew Zipkin <pinheadmz@gmail.com>
The Socks5 server we use in the test framework would disconnect by default immediately after the handshake and sometimes would not register as a connected peer by bitcoind.
805692f
to
a5c9e05
Compare
@jonatack thank you sir for the great review and suggested patches, all nits addressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK a5c9e05
a5c9e05
to
ba8ab4f
Compare
ACK ba8ab4f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crACK ba8ab4f
code lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ba8ab4f
Nice to have this additional coverage for TorV3 addresses 👍🏼
It's not intruduced by this PR, but I notice a mypy error in feature_anchors.py where a tuple is assigned to onion_conf.addr
which is initialized to None
in socks5.py.
If you do end up re-touching this for some reason, you can fix the warning by specifying the type of .addr
in socks5.py (which will also fix the other 3 ocurrences of it in the tests):
diff --git a/test/functional/test_framework/socks5.py b/test/functional/test_framework/socks5.py
index 0ca06a7396..5315f39142 100644
--- a/test/functional/test_framework/socks5.py
+++ b/test/functional/test_framework/socks5.py
@@ -8,6 +8,7 @@ import socket
import threading
import queue
import logging
+from typing import Tuple
logger = logging.getLogger("TestFramework.socks5")
@@ -36,7 +37,7 @@ def recvall(s, n):
class Socks5Configuration():
"""Proxy configuration."""
def __init__(self):
- self.addr = None # Bind address (must be set)
+ self.addr: Tuple[str, int] # Bind address (must be set)
self.af = socket.AF_INET # Bind address family
self.unauth = False # Support unauthenticated
self.auth = False # Support authentication
Closes #27140
Adds test coverage for #20516 to ensure that #20511 is completed and may be closed.
This PR adds a test case to
feature_anchors.py
where an onion v3 address is set as a blocks-only relay peer and then shutdown, ensuring that the address is saved to anchors.dat in addrv2 format. We then ensure that bitcoin attempts to reconnect to that anchor address on restart.To compute the addrv2 serialization of the onion v3 address, I added logic to
CAddress
inmessages.py
. This new logic is covered by extendingp2p_addrv2_relay.py
to include an onion v3 address. Future work will be adding coverage for ipv6, torv2 and cjdns in these modules and alsofeature_proxy.py
Also includes de/serialization unit test for
CAddress
in test framework.