mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
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.
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user