Implement ADDRv2 support (part of BIP155)#19031
Implement ADDRv2 support (part of BIP155)#19031vasild wants to merge 2 commits intobitcoin:masterfrom
Conversation
|
Concept ACK 😄 Am I correct in saying that you've replaced |
|
Concept ACK! |
Yes, thanks for asking! Ideally we would have just one So I introduced a second |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
1d8592c to
43c59ed
Compare
|
Concept ACK. WIll do a good review later. |
be45d10 to
5b5ee14
Compare
|
utACK It's important to support new Tor service version 3 and adding support for i2p and cjdns is really awesome 👍 |
|
Concept ACK |
|
Rebased on latest #19845 |
There was a problem hiding this comment.
Concept ACK 99047b0771f8dfc85640c095b8a331f4746e63e3, tested on Linux Mint 20 (x86_64).
Compare RPC and GUI output:
$ src/bitcoin-cli -netinfo 2
Bitcoin Core v0.20.99.0-336ba7ca7 - 70016/Satoshi:0.20.99/
Peer connections sorted by direction and min ping
<-> relay net mping ping send recv txn blk uptime id address
out full onion 271 313 2 1 0 6 6 mwmfluek4au6mxxpw6fy7sjhkm65bdfc7izc7lpz3trewfdghyrzsbid.onion
out full onion 272 272 1 8 0 7 2 rp7k2go3s5lyj3fnj6zn62ktarlrsft2ohlsxkyd7v3e3idqyptvread.onion
out full onion 281 281 2 2 0 6 11 mwg3wapk3trgyg3e.onion:8333
out full onion 311 337 8 8 0 6 10 jzovs6u3fjpdrtow.onion:8333
out full onion 337 404 1 1 3 6 5 lw6hmfiyqkneb7biux5maaxztcizqnryjtrytwtsynj6szfwuo7dykyd.onion
out full onion 346 410 1 7 1 7 1 h25e66x235hdrwgw.onion:8333
out full onion 361 416 1 2 0 6 12 3ibzyvezkciodlfj.onion:8333
out full onion 404 678 4 5 0 1 6 8 vuswbtydwykwd5faap72ayjrchxz3wzezsi5tobahjedhf2fbg3dj7qd.onion
out full onion 408 542 2 2 0 6 4 esorot4j7z32pr7fm62pjgqhm2g5a26aaucesohjcy3csjewgmrvvmyd.onion
out block onion 473 473 67 9 5 15 uleur3cw27x53j64.onion:8333
out full onion 501 634 6 6 0 6 7 wizbit5555bsslwv4ctronnsgk5vh2w2pdx7v7eyuivlyuoteejk7lid.onion
out full onion 539 539 2 1 0 6 3 yp77p2jxvz5nzza5.onion:8333
out full onion 546 859 2 2 0 6 9 e6pa22pv6k66lb7w.onion:8333
out full onion 623 623 3 6 0 5 13 blbmcefvms57el3f.onion:8333
out full onion 639 691 3 2 0 6 7 0 kpgvmscirrdqpekbqjsvw5teanhatztpp2gl6eee4zkowvwfxwenqaid.onion
out block onion 669 1196 59 59 5 16 4opclnv4bgcpyano.onion:8333
out full onion 1595 2047 2 1 5 14 djhudr2ovodzeyv7.onion:8333
ms ms sec sec min min min
ipv4 ipv6 onion total block-relay
in 0 0 0 0 0
out 0 0 17 17 2
total 0 0 17 17 2
Local addresses
i4ezhlel222uleirryjorb66b2wtn5ttbs6ixqciqebg2zqand6de4qd.onion port 8333 score
UPDATE: the column width in the GUI just need to be adjusted :)
|
Added more tests. |
|
Rebased on latest #19845 |
|
Mind rebasing? |
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
Change the serialization of `CAddrMan` to serialize its addresses in ADDRv2/BIP155 format by default. Introduce a new `CAddrMan` format version (3). Add support for ADDRv2 format in `CAddress` (un)serialization. Co-authored-by: Carl Dong <[email protected]>
Introduce a new message `sendaddrv2` to signal support for ADDRv2. Send the new message immediately after sending the `VERACK` message. Add support for receiving and parsing ADDRv2 messages. Send ADDRv2 messages (instead of ADDR) to a peer if he has advertised support for it. Co-authored-by: Carl Dong <[email protected]>
|
Rebased now that #19845 is merged. |

An implementation of BIP155
addrv2messages. To ease review it is split in a few logical changes and submitted as separate, smaller, PRs.The current one for review is: #19954
Preparation changes
Commits:
test: add an edge case test for CSubNet(merged via test: add two edge case tests for CSubNet #19351)net: improve encapsulation of CNetAddr(merged via net: improve encapsulation of CNetAddr #19360)net: document enum Network(merged via net: save the network type explicitly in CNetAddr #19534)net: save the network type explicitly in CNetAddr(merged via net: save the network type explicitly in CNetAddr #19534)Change
CNetAddr::ipto have flexible sizeCommits:
net: change CNetAddr::ip to have flexible size(merged via net: change CNetAddr::ip to have flexible size #19628)Implement
addrv2(un)serializingAdd support to serialize
CNetAddrandCAddressin ADDRv2 format. Invoke that fromCAddrManserialization methods. Commits:net: move HasPrefix() so it can be reused(merged via net: CNetAddr: add support to (un)serialize as ADDRv2 #19845)test: move HasReason() so it can be reused(merged via net: CNetAddr: add support to (un)serialize as ADDRv2 #19845)net: CNetAddr: add support to (un)serialize as ADDRv2(merged via net: CNetAddr: add support to (un)serialize as ADDRv2 #19845)net: recognize TORv3/I2P/CJDNS networks(merged via net: CNetAddr: add support to (un)serialize as ADDRv2 #19845)net: CAddress & CAddrMan: (un)serialize as ADDRv2(merged via Complete the BIP155 implementation and upgrade to TORv3 #19954)Advertise support
Advertise
ADDRv2support to peers, handle incomingADDRv2messages and send to peers in that format if they have advertised support. Commits:net: advertise support for ADDRv2 via new message(merged via Complete the BIP155 implementation and upgrade to TORv3 #19954)All the steps to get Tor v3 support are outlined in issue#18884 Tor v3 support, this PR is one of them.