aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2021-06-28 16:54:45 +0200
committerVasil Dimov <vd@FreeBSD.org>2021-07-09 11:19:38 +0200
commite0a2b390c144e123e2fc8a289fdff36815476964 (patch)
tree82fbf2ebcdd5ccb38cb1add7ec8390801013eb8a /src/addrman.h
parent41cda9d075ebcab1dbb950160ebe9d0ba7b5745e (diff)
addrman: reset I2P ports to 0 when loading from disk
This is a temporary change to convert I2P addresses that have propagated with port 8333 to ones with port 0. It would cause a problem some day if indeed some bitcoin software is listening on port 8333 only and rejects connections to port 0 and we are still using SAM 3.1 which only supports port 0. In this case we would replace 8333 with 0 and try to connect to such nodes. This commit should be included in 22.0 and be reverted before 23.0 is released.
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/addrman.h b/src/addrman.h
index c2f425f2fa..2a5c6c06b4 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -452,6 +452,8 @@ public:
RemoveInvalid();
+ ResetI2PPorts();
+
Check();
}
@@ -767,6 +769,14 @@ private:
//! Remove invalid addresses.
void RemoveInvalid() EXCLUSIVE_LOCKS_REQUIRED(cs);
+ /**
+ * Reset the ports of I2P peers to 0.
+ * This is needed as a temporary measure because now we enforce port 0 and
+ * only connect to I2P hosts if the port is 0, but in the early days some
+ * I2P addresses with port 8333 were rumoured and persisted into addrmans.
+ */
+ void ResetI2PPorts() EXCLUSIVE_LOCKS_REQUIRED(cs);
+
friend class CAddrManTest;
};