Page MenuHomePhabricator

init: introduce I2P connectivity options
ClosedPublic

Authored by PiRK on Feb 10 2022, 09:11.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCbdcf5ed386bb: init: introduce I2P connectivity options
Summary

Introduce two new options to reach the I2P network:

  • -i2psam=<ip:port> point to the I2P SAM proxy. If this is set then the I2P network is considered reachable and we can make outgoing connections to I2P peers via that proxy. We listen for and accept incoming connections from I2P peers if the below is set in addition to -i2psam=<ip:port>
  • -i2pacceptincoming if this is set together with -i2psam=<ip:port> then we accept incoming I2P connections via the I2P SAM proxy.

Add functional tests.

This is a backport of core#20685 [15/20]
https://github.com/bitcoin/bitcoin/pull/20685/commits/76c35c60f338937071bcfad4211ef7254d3830ec

Depends on D11025 and D11028

Test Plan

ninja all check-all

Install i2prouter, start it (i2prouter start) , start the SAM bridge (can be done in a browser http://127.0.0.1:7657/configclients), then run:

ninja && src/bitcoind -regtest -i2psam=127.0.0.1:7656 -debug=i2p

At this point, it still does not do much, but the new command line options are accepted.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Feb 10 2022, 09:11
src/net.h
950 ↗(On Diff #32312)

I initialized the bool value to fix a cppcheck error. It makes sense to set it to true, because this seems to be the default value in init.cpp (line 3113), but it ultimately does not matter because it is not used anywhere before it is set.

Failed tests logs:

====== Bitcoin ABC functional tests: abc_p2p_getavaaddr.py ======

------- Stdout: -------
2022-02-10T09:21:20.692000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20220210_091541/abc_p2p_getavaaddr_191
2022-02-10T09:21:24.843000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.450000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.451000Z TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:22354 due to [Errno 104] Connection reset by peer
2022-02-10T09:21:28.458000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 132, in main
    self.run_test()
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 201, in run_test
    self.address_test(maxaddrtosend=3, num_proof=2, num_avanode=8)
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 183, in address_test
    requester = node.add_p2p_connection(AddrReceiver())
  File "/work/test/functional/test_framework/test_node.py", line 701, in add_p2p_connection
    p2p_conn.wait_for_verack()
  File "/work/test/functional/test_framework/p2p.py", line 604, in wait_for_verack
    self.wait_until(test_function, timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 518, in wait_until
    timeout_factor=self.timeout_factor)
  File "/work/test/functional/test_framework/util.py", line 273, in wait_until_helper
    if predicate():
  File "/work/test/functional/test_framework/p2p.py", line 514, in test_function
    assert self.is_connected
AssertionError
2022-02-10T09:21:28.509000Z TestFramework (INFO): Stopping nodes
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/test_framework/authproxy.py", line 116, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.7/http/client.py", line 1260, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1069, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.7/http/client.py", line 991, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 207, in <module>
    AvaAddrTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 152, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 280, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 514, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 426, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/coverage.py", line 47, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 161, in __call__
    'POST', self.__url.path, postdata.encode('utf-8'))
  File "/work/test/functional/test_framework/authproxy.py", line 122, in _request
    self.__conn.request(method, path, postdata, headers)
  File "/usr/lib/python3.7/http/client.py", line 1260, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 970, in send
    self.connect()
  File "/usr/lib/python3.7/http/client.py", line 942, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_p2p_getavaaddr.py

PiRK edited the summary of this revision. (Show Details)
PiRK added a parent revision: D11028: Bump version to 0.25.0.

rebase and add release notes

rebase for release notes version

PiRK planned changes to this revision.Feb 11 2022, 08:03

testing ongoing

PiRK requested review of this revision.Feb 11 2022, 14:36
PiRK edited the test plan for this revision. (Show Details)

Edited test plan to add a manual test plan with instructions on how to use the new options.

This revision is now accepted and ready to land.Feb 14 2022, 09:43
This revision was automatically updated to reflect the committed changes.