-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
net: save the network type explicitly in CNetAddr #19534
net: save the network type explicitly in CNetAddr #19534
Conversation
05106b9
to
2a6a9ce
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
2a6a9ce
to
eb22eed
Compare
Rebased to wake up Travis |
ACK eb22eed If you make any changes, consider running |
So if i read this correct, if this is merged we narrow before even having benefit and v3 , and say an address is not routable if one flag in CNetAddr m_net say's something else than m_net == NET_IPV6 and skip that the Bitcoin imperative 'data decides' So you want to change even the old ADDRv1 logic while BIP155 say's don't. hmm... And btw if ip is filled with << instead of memcpy and data don't decide, how sophisticated is the checksum plan for bit or byte errors in the new ADDRv1/v2 stream? btw Since the BIP155 ADDv2 is to send ip2 and v3 just as 32 byte without checksum, i would also recommend to concat least sig byte of hash(m net | 32 byte ) before send, but that;s prob a PR for BIP155. |
Concept ACK, Approach ACK. The BIP refers to I2P and CJDNS overlay networks and gives them their own network IDs. An I2P address is a Tor v3 address and a CJDNS address is a IPV6 address (or at least they are the same size) right? I'm just trying to understand why they warrant their own reserved network IDs in the BIP but don't seem to be implemented here? |
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.
Light ACK eb22eed though viewed in isolation this change seems to be making the code more complex, not simpler.
@@ -322,13 +330,7 @@ enum Network CNetAddr::GetNetwork() const | |||
if (!IsRoutable()) | |||
return NET_UNROUTABLE; | |||
|
|||
if (IsIPv4()) |
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.
Is this code still needed in GetNetwork()
?
if (IsInternal())
return NET_INTERNAL;
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 - no. But it was not necessary before this PR either. Some good simplification can be done here even on master
. I will see whether it is better to add a new commit to this PR or file it as a separate PR.
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.
Correction - it is needed, otherwise this test would fail:
https://github.com/bitcoin/bitcoin/blob/476436b/src/test/netbase_tests.cpp#L45
Anyway, I made some simplifications on top of this PR that remove the "extending" of enum Network
with NET_UNKNOWN
and NET_TEREDO
and also removed GetExtNetwork()
. To avoid distractions, I will not append those commits to this PR but would rather open a new PR against master
, once this PR gets merged.
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 @vasild, looking forward to reviewing the simplifications.
src/netaddress.h
Outdated
|
||
/// A set of dummy addresses that map a name to an IPv6 address. | ||
NET_INTERNAL, |
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 change:
/// A set of special crafted FC00/7 IPv6 addresses we use to map a string or FQDN to an IPv6 address.
/// We uses these important fake addresses also in CAddrMan to keep track of which DNS seeds were used
/// and how we manage buckets and peers.
With that in mind when dev we can take special care in transit to ADDRv2 to not mess with this address realm,
because we need them later to get our new long addresses in and out from peers,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.
I extended the comment, thanks!
In #19031 we drop the 6-byte fd6b:88c0:8724
prefix from these addresses and store them in memory as m_net=NET_INTERNAL, m_addr=...10 bytes...
. Serializing that to addrv1
remains unchanged (we add the fd6b:88c0:8724
prefix) and they are never serialized as addrv2
.
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.
Not that related here and just to your info, the follow up construction on this run in an assert failure when i made the v3 patch,
The structures need also some failure tolerance and flexibility.
Don;t mind if i am harsh and sometimes sarcastic, but you do here heart surgery and better not look good but beat the drum
Also to get in an out of peers and DNS seeds is somewhat unrelated to the data structure on the ADDR net.
We could easy use intern more data and flags on our address than we use on the wire.
Those two structures need not to be the same.
edit@saiboto what let me tend to ADDRv2 is 2038. tyi.
@michaelfolkson, the sizes of I2P and Torv3 addresses are equal (32 bytes) and also IPv6 and CJDNS addresses are both 16 bytes, but their interpretation is different - ie given some chunk of 32 bytes we need to know whether that is an I2P address or Torv3 address. This is why they have a separate network ids. Also there could be an overlap - e.g. some 16 bytes could both be valid IPv6 address and a valid CJDNS address. The code in this PR and its parent PR (#19031) aims to implement ADDRv2 address format and signaling with the networks that are currently supported. Once that is done, on top of it, we will implement new networks like Torv3, I2P and others. |
eb22eed
to
662bb25
Compare
Extended the |
if (memcmp(ip, pchLocal, 16) == 0) | ||
if (IsIPv6() && memcmp(ip, pchLocal, 16) == 0) | ||
return 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.
In general some of this might be optimized out by the compiler,
And i would prefer for the transition period something like this that we can refactor out when all works fine
to an compiler and bytecode friendly version.
I would prefer constructions for all those ipv6 overrides in the rest of the code to look like this
suggested change:
if (memcmp(ip, pchLocal, 16) == 0) && IsIPv6();
And some logging here and in the other overrides i.e.
LogPrint(BCLog::ADDV2, "old isXXXX() says so, ADDRv2 m_net did override with value = xxx .....
re-ACK 662bb25 per |
reACK 662bb25 Only change is in a comment. |
tyi, I will not ACK or NACK any of ADDRv2 roadmap, Since Tor v2 will be deprecated sooner or later. I will try to start a side project to morph some old legacy tunnel code code to a special general 'bitcoin-peer-address' tor or whatever proxy wrapper, for all old nodes to have full v3 and after 2038 support, without need to softfork This will from day one, mitigate any chainsplit or censorship. |
Just to clarify - ADDRv2/BIP155 does not involve a softfork, chainsplit or censorship. Old nodes (e.g. 0.19.1) can't have full support for TORv3 because they don't contain the code for it. |
I full support ADDRv2 and i will comment and provide review. My approach aims to let old tor nodes not behind and be forced to softfork when tor v2 fades out.
I love this cant's in software dev, because i can, That wrapper is on track and orthogonal to this here and when ADDRv2 is there, it will be even more easy to support this. Maybe it will make its path to contrib to assist all old node software in support of protocols aside from internet protocol. edit@saibato tl;trThe status quo, so far is that even now every tor v2 proxy capable node, can even now connect over tor v3 9050 socks5 proxy to any node that provides a v3 inbound hidden service over torrc. What missing is a bit virgin seeding that could be done by a signed script file and banman and conman bitcoin logic and then address gossip about that and to store this, for node reboot, if you don;t want to run every time a long bash cli addnode <v3.onion> add .script or a long cmdline. All can be solved without touching the old software. And since we have a great FC00/7 space for grabs in all old nodes, that could i.e. bind tun or taps to them to proxy out to even stranger protocols. |
Coverage report of modified code: https://people.freebsd.org/~vd/pr19534_662bb25ef_coverage/ |
wow, that was really funny took,me a while to figure out the zero. is a morse placeholder. This kind of humor makes really fun and that i like so much when programing senator brains. I almost tend to blind ACK |
Made 2 changes as per review suggestions:
|
662bb25
to
64897c5
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.
reACK 64897c5 via git range-diff master 662bb25 64897c5
Just one comment
Before this change, we would analyze the contents of `CNetAddr::ip[16]` in order to tell which type is an address. Change this by introducing a new member `CNetAddr::m_net` that explicitly tells the type of the address. This is necessary because in BIP155 we will not be able to tell the address type by just looking at its raw representation (e.g. both TORv3 and I2P are "seemingly random" 32 bytes). As a side effect of this change we no longer need to store IPv4 addresses encoded as IPv6 addresses - we can store them in proper 4 bytes (will be done in a separate commit). Also the code gets somewhat simplified - instead of `memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0` we can use `m_net == NET_IPV4`. Co-authored-by: Carl Dong <contact@carldong.me>
64897c5
to
bcfebb6
Compare
reACK bcfebb6 via |
Updated a comment to reflect that we now call |
re-ACK bcfebb6 per |
Concept ACK. |
Code review ACK bcfebb6 |
memcpy(ip, ipIn.ip, sizeof(ip)); | ||
} | ||
|
||
void CNetAddr::SetLegacyIPv6(const uint8_t ipv6[16]) |
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.
Any reason to pass around fixed-length data with a raw data pointer (of arbitrary length) when type safe alternatives like span or std::array (probably not applicable in this case) are available?
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 input has to be 16 bytes, in this case. Is there a way to enforce this in the type, for spans?
(sure, the [16]
doesn't do anything here either except as a signal to the programmer)
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.
Not sure, but I presumed spans could be of non-dynamic extent as well. Does this not work?
const std::span<uint8_t, 16>& ipv6
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, in this case the [16]
is just a "signal to the programmer". In SetRaw()
we have a bare pointer const uint8_t*
when calling this function.
I have removed SetRaw()
in the subsequent commit and will revisit this code.
Some experiments:
int f1(const std::span<int, 3>& p)
{
return p[5]; // no warning
}
int f2(const int (&p)[3])
{
return p[5]; // warning: array index 5 is past the end of the array (which contains 3 elements) [-Warray-bounds]
}
int f3(const std::array<int, 3>& p)
{
return p[5]; // no warning
}
int main(int, char**) {
int a[3];
int b[2];
f1(a);
f1(b); // error: no known conversion from 'int [2]' to 'const std::span<int, 3>'
f2(a);
f2(b); // error: no known conversion from 'int [2]' to 'const int [3]'
f3(std::array<int, 3>{a[0], a[1], a[2]});
return 0;
}
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.
So, in #19628 I changed the argument to const uint8_t (&ipv6)[ADDR_IPv6_SIZE]
mostly to make the interface clean. From 3 callers 2 need an abusive typecasts because they don't have an array (one has bare pointer (the fuzz tests) and the other has struct in6_addr
).
Feel free to comment there: https://github.com/bitcoin/bitcoin/pull/19628/files#diff-b64569708508232923e5fe3059396334R28
bcfebb6 net: save the network type explicitly in CNetAddr (Vasil Dimov) 100c64a net: document `enum Network` (Vasil Dimov) Pull request description: (chopped off from bitcoin#19031 to ease review) Before this change, we would analyze the contents of `CNetAddr::ip[16]` in order to tell which type is an address. Change this by introducing a new member `CNetAddr::m_net` that explicitly tells the type of the address. This is necessary because in BIP155 we will not be able to tell the address type by just looking at its raw representation (e.g. both TORv3 and I2P are "seemingly random" 32 bytes). As a side effect of this change we no longer need to store IPv4 addresses encoded as IPv6 addresses - we can store them in proper 4 bytes (will be done in a separate commit). Also the code gets somewhat simplified - instead of `memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0` we can use `m_net == NET_IPV4`. ACKs for top commit: troygiorshev: reACK bcfebb6 via `git range-diff master 64897c5 bcfebb6` jonatack: re-ACK bcfebb6 per `git diff 662bb25 bcfebb6`, code review, debug build/tests clean, ran bitcoind. laanwj: Code review ACK bcfebb6 Tree-SHA512: 9347e2a50feac617a994bfb46a8f77e31c236bde882e4fd4f03eea4766cd5110216f5f3d24dee91d25218bab7f8bb6e1d2d6212a44db9e34594299fd6ff7606b
bcfebb6 net: save the network type explicitly in CNetAddr (Vasil Dimov) 100c64a net: document `enum Network` (Vasil Dimov) Pull request description: (chopped off from bitcoin#19031 to ease review) Before this change, we would analyze the contents of `CNetAddr::ip[16]` in order to tell which type is an address. Change this by introducing a new member `CNetAddr::m_net` that explicitly tells the type of the address. This is necessary because in BIP155 we will not be able to tell the address type by just looking at its raw representation (e.g. both TORv3 and I2P are "seemingly random" 32 bytes). As a side effect of this change we no longer need to store IPv4 addresses encoded as IPv6 addresses - we can store them in proper 4 bytes (will be done in a separate commit). Also the code gets somewhat simplified - instead of `memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0` we can use `m_net == NET_IPV4`. ACKs for top commit: troygiorshev: reACK bcfebb6 via `git range-diff master 64897c5 bcfebb6` jonatack: re-ACK bcfebb6 per `git diff 662bb25 bcfebb6`, code review, debug build/tests clean, ran bitcoind. laanwj: Code review ACK bcfebb6 Tree-SHA512: 9347e2a50feac617a994bfb46a8f77e31c236bde882e4fd4f03eea4766cd5110216f5f3d24dee91d25218bab7f8bb6e1d2d6212a44db9e34594299fd6ff7606b Signed-off-by: pasta <pasta@dashboost.org> # Conflicts: # src/netaddress.cpp # src/netaddress.h
bcfebb6 net: save the network type explicitly in CNetAddr (Vasil Dimov) 100c64a net: document `enum Network` (Vasil Dimov) Pull request description: (chopped off from bitcoin#19031 to ease review) Before this change, we would analyze the contents of `CNetAddr::ip[16]` in order to tell which type is an address. Change this by introducing a new member `CNetAddr::m_net` that explicitly tells the type of the address. This is necessary because in BIP155 we will not be able to tell the address type by just looking at its raw representation (e.g. both TORv3 and I2P are "seemingly random" 32 bytes). As a side effect of this change we no longer need to store IPv4 addresses encoded as IPv6 addresses - we can store them in proper 4 bytes (will be done in a separate commit). Also the code gets somewhat simplified - instead of `memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0` we can use `m_net == NET_IPV4`. ACKs for top commit: troygiorshev: reACK bcfebb6 via `git range-diff master 64897c5 bcfebb6` jonatack: re-ACK bcfebb6 per `git diff 662bb25 bcfebb6`, code review, debug build/tests clean, ran bitcoind. laanwj: Code review ACK bcfebb6 Tree-SHA512: 9347e2a50feac617a994bfb46a8f77e31c236bde882e4fd4f03eea4766cd5110216f5f3d24dee91d25218bab7f8bb6e1d2d6212a44db9e34594299fd6ff7606b Signed-off-by: pasta <pasta@dashboost.org> # Conflicts: # src/netaddress.cpp # src/netaddress.h
bcfebb6 net: save the network type explicitly in CNetAddr (Vasil Dimov) 100c64a net: document `enum Network` (Vasil Dimov) Pull request description: (chopped off from bitcoin#19031 to ease review) Before this change, we would analyze the contents of `CNetAddr::ip[16]` in order to tell which type is an address. Change this by introducing a new member `CNetAddr::m_net` that explicitly tells the type of the address. This is necessary because in BIP155 we will not be able to tell the address type by just looking at its raw representation (e.g. both TORv3 and I2P are "seemingly random" 32 bytes). As a side effect of this change we no longer need to store IPv4 addresses encoded as IPv6 addresses - we can store them in proper 4 bytes (will be done in a separate commit). Also the code gets somewhat simplified - instead of `memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0` we can use `m_net == NET_IPV4`. ACKs for top commit: troygiorshev: reACK bcfebb6 via `git range-diff master 64897c5 bcfebb6` jonatack: re-ACK bcfebb6 per `git diff 662bb25 bcfebb6`, code review, debug build/tests clean, ran bitcoind. laanwj: Code review ACK bcfebb6 Tree-SHA512: 9347e2a50feac617a994bfb46a8f77e31c236bde882e4fd4f03eea4766cd5110216f5f3d24dee91d25218bab7f8bb6e1d2d6212a44db9e34594299fd6ff7606b Signed-off-by: pasta <pasta@dashboost.org> # Conflicts: # src/netaddress.cpp # src/netaddress.h
Summary: ``` Before this change, we would analyze the contents of CNetAddr::ip[16] in order to tell which type is an address. Change this by introducing a new member CNetAddr::m_net that explicitly tells the type of the address. This is necessary because in BIP155 we will not be able to tell the address type by just looking at its raw representation (e.g. both TORv3 and I2P are "seemingly random" 32 bytes). As a side effect of this change we no longer need to store IPv4 addresses encoded as IPv6 addresses - we can store them in proper 4 bytes (will be done in a separate commit). Also the code gets somewhat simplified - instead of memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0 we can use m_net == NET_IPV4. ``` Backport of core [[bitcoin/bitcoin#19534 | PR19534]]. Depends on D9170 and D9171. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9172
ecde04a [Consensus] Bump Active Protocol version to 70923 for v5.3 (random-zebra) b63e4f5 Consensus: Add v5.3 enforcement height for testnet. (furszy) f44be94 Only relay IPv4, IPv6, Tor addresses (Pieter Wuille) 015298c fix: tor: Call event_base_loopbreak from the event's callback (furszy) 34ff7a8 Consensus: Add mnb ADDRv2 guard. (furszy) b4515dc GUI: Present v3 onion addresses properly in MNs list. (furszy) 337d43d tests: don't export in6addr_loopback (Vasil Dimov) 2cde8e0 GUI: Do not show the tor v3 onion address in the topbar. (furszy) 0b5f406 Doc: update tor.md with latest upstream information. (furszy) 89df7f2 addrman: ensure old versions don't parse peers.dat (Vasil Dimov) bb90c5c test: add getnetworkinfo network name regression tests (Jon Atack) d8e01b5 rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack) 57fc7b0 net: update GetNetworkName() with all enum Network cases (Jon Atack) 647d60b tests: Modify rpc_bind to conform to bitcoin#14532 behaviour. (Carl Dong) d4d6729 Allow running rpc_bind.py --nonloopback test without IPv6 (Kristaps Kaupe) 4a034d8 test: Add rpc_bind test to default-run tests (Wladimir J. van der Laan) 61a08af [tests] bind functional test nodes to 127.0.0.1 Prevents OSX firewall (Sjors Provoost) 6a4f1e0 test: Add basic addr relay test (furszy) 78aa61c net: Make addr relay mockable (furszy) ba954ca Send and require SENDADDRV2 before VERACK (Pieter Wuille) 61c2ed4 Bump net protocol version + don't send 'sendaddrv2' to pre-70923 software (furszy) ccd508a tor: make a TORv3 hidden service instead of TORv2 (Vasil Dimov) 6da9a14 net: advertise support for ADDRv2 via new message (furszy) e58d5d0 Migrate to test_large_inv() to Misbehaving logging. (furszy) d496b64 [QA] fix mininode CAddress ser/deser (Jonas Schnelli) cec9567 net: CAddress & CAddrMan: (un)serialize as ADDRv2 Change the serialization of `CAddrMan` to serialize its addresses in ADDRv2/BIP155 format by default. Introduce a new `CAddrMan` format version (3). (furszy) b8c1dda streams update: get rid of nType and nVersion. (furszy) 3eaa273 Support bypassing range check in ReadCompactSize (Pieter Wuille) a237ba4 net: recognize TORv3/I2P/CJDNS networks (Vasil Dimov) 8e50853 util: make EncodeBase32 consume Spans (Sebastian Falbesoner) 1f67e30 net: CNetAddr: add support to (un)serialize as ADDRv2 (Vasil Dimov) 2455420 test: move HasReason so it can be reused (furszy) d41adb4 util: move HasPrefix() so it can be reused (Vasil Dimov) f6f86af Unroll Keccak-f implementation (Pieter Wuille) 45222e6 Implement keccak-f[1600] and SHA3-256 (Pieter Wuille) 08ad06d net: change CNetAddr::ip to have flexible size (furszy) 3337219 net: improve encapsulation of CNetAddr. (furszy) 910d5c4 test: Do not instantiate CAddrDB for static call (Hennadii Stepanov) 6b607ef Drop IsLimited in favor of IsReachable (Ben Woosley) a40711b IsReachable is the inverse of IsLimited (DRY). Includes unit tests (marcaiaf) 8839828 net: don't accept non-left-contiguous netmasks (Vasil Dimov) 5d7f864 rpcbind: Warn about exposing RPC to untrusted networks (Luke Dashjr) 2a6abd8 CNetAddr: Add IsBindAny method to check for INADDR_ANY (Luke Dashjr) 4fdfa45 net: Always default rpcbind to localhost, never "all interfaces" (Luke Dashjr) 31064a8 net: Minor accumulated cleanups (furszy) 9f9c871 tests: Avoid using C-style NUL-terminated strings as arguments (practicalswift) f6c52a3 tests: Add tests to make sure lookup methods fail on std::string parameters with embedded NUL characters (practicalswift) a751b9b net: Avoid using C-style NUL-terminated strings as arguments in the netbase interface (furszy) f30869d test: add IsRFC2544 tests (Mark Tyneway) ed5abe1 Net: Proper CService deserialization + GetIn6Addr return false if addr isn't an IPv6 addr (furszy) 86d73fb net: save the network type explicitly in CNetAddr (Vasil Dimov) ad57dfc net: document `enum Network` (Vasil Dimov) cb160de netaddress: Update CNetAddr for ORCHIDv2 (Carl Dong) c3c04e4 net: Better misbehaving logging (furszy) 3660487 net: Use C++11 member initialization in protocol (Marco) 082baa3 refactor: Drop unused CBufferedFile::Seek() (Hennadii Stepanov) e2d776a util: CBufferedFile fixes (Larry Ruane) 6921f42 streams: backport OverrideStream class (furszy) Pull request description: Conjunction of a large number of back ports, updates and refactorings that made with the final goal of implementing v3 Onion addresses support (BIP155 https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki) before the tor v2 addresses EOL, scheduled, by the Tor project, for (1) July 15th: v2 addr support removal from the code base, and (2) October 15th: v2 addr network disable, where **every peer in our network running under Tor will loose the connection and drop the network**. As BIP155 describes, this is introducing a new P2P message to gossip longer node addresses over the P2P network. This is required to support new-generation Onion addresses, I2P, and potentially other networks that have longer endpoint addresses than fit in the 128 bits of the current addr message. In order to achieve the end goal, had to: 1. Create Span class and push it up to latest Bitcoin implementation. 2. Update the whole serialization framework and every object using it up to latest Bitcoin implementation (3-4 years ahead of what we currently are in master). 3. Update the address manager implementing ASN-based bucketing of the network nodes. 4. Update and refactor the netAddress and address manager tests to latest Bitcoin implementation (4 years ahead of what we currently are in master). 5. Several util string, vector, encodings, parsing, hashing backports and more.. Important note: This PR it is not meant to be merged as a standalone PR, will decouple smaller ones moving on. Adding on each sub-PR its own description isolated from this big monster. Second note: This is still a **work-in-progress**, not ready for testing yet. I'm probably missing to mention few PRs that have already adapted to our sources. Just making it public so can decouple the changes, we can start merging them and i can continue working a bit more confortable (rebase a +170 commits separate branch is not fun..). ### List of back ported and adapted PRs: Span and Serialization: ---------------- * bitcoin#12886. * bitcoin#12916. * bitcoin#13558. * bitcoin#13697. (Only Span's commit 29943a9) * bitcoin#17850. * bitcoin#17896. * bitcoin#12752. * bitcoin#16577. * bitcoin#16670. (without faebf62) * bitcoin#17957. * bitcoin#18021. * bitcoin#18087. * bitcoin#18112 (only from 353f376 that we don't support). * bitcoin#18167. * bitcoin#18317. * bitcoin#18591 (only Span's commit 0fbde48) * bitcoin#18468. * bitcoin#19020. * bitcoin#19032. * bitcoin#19367. * bitcoin#19387. Net, NetAddress and AddrMan: ---------------- * bitcoin#7932. * bitcoin#10756. * bitcoin#10765. * bitcoin#12218. * bitcoin#12855. * bitcoin#13532. * bitcoin#13575. * bitcoin#13815. * bitcoin#14532. * bitcoin#15051. * bitcoin#15138. * bitcoin#15689. * bitcoin#16702. * bitcoin#17243. * bitcoin#17345. * bitcoin#17754. * bitcoin#17758. * bitcoin#17812. * bitcoin#18023. * bitcoin#18454. * bitcoin#18512. * bitcoin#19314. * bitcoin#19687 Keys and Addresses encoding: ---------------- * bitcoin#11372. * bitcoin#17511. * bitcoin#17721. Util: ---------------- * bitcoin#9140. * bitcoin#16577. * bitcoin#16889. * bitcoin#19593. Bench: ---------------- * bitcoin#16299. BIP155: ---------------- * bitcoin#19351. * bitcoin#19360. * bitcoin#19534. * bitcoin#19628. * bitcoin#19841. * bitcoin#19845. * bitcoin#19954. * bitcoin#19991 (pending). * bitcoin#19845. * bitcoin#20000 (pending). * bitcoin#20120. * bitcoin#20284. * bitcoin#20564. * bitcoin#21157 (pending). * bitcoin#21564 (pending). * Fully removed v2 onion addr support. * Add hardcoded seeds. * Add release-notes, changes to files.md and every needed documentation. I'm currently working on the PRs marked as "pending", this isn't over, but I'm pretty pretty close :). What a long road.. ACKs for top commit: random-zebra: utACK ecde04a Fuzzbawls: ACK ecde04a Tree-SHA512: 82c95fbda76fce63f96d8a9af7fa9a89cb1e1b302b7891e27118a6103af0be23606bf202c7332fa61908205e6b6351764e2ec23d753f1e2484028f57c2e8b51a
backport of bitcoin/bitcoin#19534 to our codebase. CNetAddr, CService, CSubNet: declare operator!= via operator== . TODO: solve addrman_serialization test (!), for now, after we introduce m_net member in CNetAddr and have modified operator < - this test failed. Return the operator < of CNetAddr to its previous state solve the issue.
(chopped off from #19031 to ease review)
Before this change, we would analyze the contents of
CNetAddr::ip[16]
in order to tell which type is an address. Change this by introducing a
new member
CNetAddr::m_net
that explicitly tells the type of theaddress.
This is necessary because in BIP155 we will not be able to tell the
address type by just looking at its raw representation (e.g. both TORv3
and I2P are "seemingly random" 32 bytes).
As a side effect of this change we no longer need to store IPv4
addresses encoded as IPv6 addresses - we can store them in proper 4
bytes (will be done in a separate commit). Also the code gets
somewhat simplified - instead of
memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0
we can usem_net == NET_IPV4
.