Skip to content

Commit 655937e

Browse files
committed
Merge #19845: net: CNetAddr: add support to (un)serialize as ADDRv2
7be6ff6 net: recognize TORv3/I2P/CJDNS networks (Vasil Dimov) e0d7357 net: CNetAddr: add support to (un)serialize as ADDRv2 (Vasil Dimov) fe42411 test: move HasReason so it can be reused (Vasil Dimov) d2bb681 util: move HasPrefix() so it can be reused (Vasil Dimov) Pull request description: (chopped off from #19031 to ease review) Add an optional support to serialize/unserialize `CNetAddr` in ADDRv2 format (BIP155). The new serialization is engaged by ORing a flag into the stream version. So far this is only used in tests to ensure the new code works as expected. ACKs for top commit: Sjors: re-tACK 7be6ff6 sipa: re-utACK 7be6ff6 eriknylund: ACK 7be6ff6 I built the PR on macOS Catalina 10.15.6, ran both tests and functional tests. I've reviewed the code and think the changes look good and according to BIP155. I verified that the added Base32 encoding test looks as proposed and working. I've run a node for a week only with Onion addresses `-onlynet=onion` without issues and I can connect to other peer reviewers running TorV3 on their nodes and I can connect both of my test nodes to each other. jonatack: re-ACK 7be6ff6 per `git diff b9c46e0 7be6ff6`, debug build, ran/running bitcoind with this change and observed the log and `-netinfo` peer connections while connected as a tor v2 service to both tor v2 peers and also five tor v3 peers. hebasto: ACK 7be6ff6, tested on Linux Mint 20 (x86_64): on top of this pull and #19031 I'm able to connect to onion v3 addresses, and jonatack is able to connect to my created onion v3 address. Tree-SHA512: dc621411ac4393993aa3ccad10991717ec5f9f2643cae46a24a89802df0a33d6042994fc8ff2f0f397a3dbcd1c0e58fe4724305a2f9eb64d9342c3bdf784d9be
2 parents 2552702 + 7be6ff6 commit 655937e

File tree

12 files changed

+783
-77
lines changed

12 files changed

+783
-77
lines changed

src/crypto/common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ void static inline WriteLE64(unsigned char* ptr, uint64_t x)
5353
memcpy(ptr, (char*)&v, 8);
5454
}
5555

56+
uint16_t static inline ReadBE16(const unsigned char* ptr)
57+
{
58+
uint16_t x;
59+
memcpy((char*)&x, ptr, 2);
60+
return be16toh(x);
61+
}
62+
5663
uint32_t static inline ReadBE32(const unsigned char* ptr)
5764
{
5865
uint32_t x;

0 commit comments

Comments
 (0)