fix: replace CI2PSession (process-I2P) with CI2PEmbedded in merged code

Merge left residual references to the SAMI-PC process-based I2P API
(CI2PSession, fI2P) in files that now compile against the v6 embedded
I2P (CI2PEmbedded). Fixed:
- net.cpp ConnectNode: removed fI2P/CI2PSession blocks, restored
  v6 SOCKS-proxy connection path (I2P routing handled in netbase)
- CMakeLists.txt: removed i2p.cpp/i2p_process.cpp from build (not
  part of embedded I2P; kept in tree as reference only)
- rpcnet.cpp: CI2PSession → CI2PEmbedded (IsRunning/GetI2PAddress)
- rpcwallet.cpp: same API migration
- init.cpp: same API migration for startup address print
This commit is contained in:
Krystie
2026-06-29 15:21:11 -07:00
parent 8615e6b46d
commit 9ed79d53a6
5 changed files with 11 additions and 35 deletions
-2
View File
@@ -54,8 +54,6 @@ set(CORE_SOURCES
net.cpp
net_bootstrap.cpp
netbase.cpp
i2p.cpp
i2p_process.cpp
protocol.cpp
script.cpp
sync.cpp
+1 -1
View File
@@ -1706,7 +1706,7 @@ bool AppInit2()
StartupPerfLog("i2p_start", GetTimeMillis() - nI2PStart, strprintf("started=%d", i2pStarted));
if (i2pStarted) {
SetReachable(NET_I2P, true);
std::string i2pAddr = CI2PSession::GetInstance()->GetB32Address();
std::string i2pAddr = CI2PEmbedded::GetInstance()->GetI2PAddress();
printf("I2P network enabled. Our address: %s\n", i2pAddr.c_str());
} else {
printf("NOTICE: I2P not available this session; continuing with Tor only\n");
+2 -24
View File
@@ -591,16 +591,6 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest)
return nullptr;
}
// For I2P make sure addrConnect carries the destination so the resulting
// CNode is labelled correctly even when we were given a bare pszDest.
if (fI2P && !addrConnect.IsI2P()) {
std::string i2pHost = addrStr;
size_t i2pEnd = i2pHost.find(".i2p");
if (i2pEnd != std::string::npos)
i2pHost = i2pHost.substr(0, i2pEnd + 4);
addrConnect.SetSpecial(i2pHost);
}
if (pszDest == nullptr) {
if (IsLocal(addrConnect))
return nullptr;
@@ -624,20 +614,8 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest)
pszDest ? 0 : (double)(GetAdjustedTime() - addrConnect.nTime)/3600.0);
// Connect
SOCKET hSocket = INVALID_SOCKET;
bool fConnected;
if (fI2P) {
// Route through the I2P SAM session. Strip any :port suffix; I2P peers
// are reached purely by destination.
std::string i2pDest = addrStr;
size_t i2pEnd = i2pDest.find(".i2p");
if (i2pEnd != std::string::npos)
i2pDest = i2pDest.substr(0, i2pEnd + 4);
fConnected = CI2PSession::GetInstance()->Connect(i2pDest, hSocket);
} else {
fConnected = pszDest ? ConnectSocketByName(addrConnect, hSocket, pszDest, GetDefaultPort()) : ConnectSocket(addrConnect, hSocket);
}
if (fConnected)
SOCKET hSocket;
if (pszDest ? ConnectSocketByName(addrConnect, hSocket, pszDest, GetDefaultPort()) : ConnectSocket(addrConnect, hSocket))
{
addrman.Attempt(addrConnect);
+6 -6
View File
@@ -10,7 +10,7 @@
#include "db.h"
#include "walletdb.h"
#include "net_bootstrap.h"
#include "i2p.h"
#include "i2p/i2p_embedded.h"
#include "tor/onion_v3.h"
#include "tor/tor_embedded.h"
@@ -42,8 +42,8 @@ Value getnetworkinfo(const Array& params, bool fHelp)
if (onionAddress.empty())
onionAddress = CTorEmbedded::GetInstance()->GetOnionAddress();
// I2P session state and .b32.i2p address.
CI2PSession* i2p = CI2PSession::GetInstance();
// I2P embedded router state and .b32.i2p address.
CI2PEmbedded* i2p = CI2PEmbedded::GetInstance();
int nI2PPeers = 0;
{
LOCK(cs_vNodes);
@@ -52,9 +52,9 @@ Value getnetworkinfo(const Array& params, bool fHelp)
nI2PPeers++;
}
Object i2pObj;
i2pObj.push_back(Pair("enabled", i2p->IsEnabled()));
i2pObj.push_back(Pair("active", i2p->IsActive()));
i2pObj.push_back(Pair("address", i2p->GetB32Address()));
i2pObj.push_back(Pair("enabled", i2p->IsRunning()));
i2pObj.push_back(Pair("active", i2p->IsRunning()));
i2pObj.push_back(Pair("address", i2p->GetI2PAddress()));
i2pObj.push_back(Pair("peers", nI2PPeers));
Object obj;
+2 -2
View File
@@ -9,7 +9,7 @@
#include "init.h"
#include "base58.h"
#include "smessage.h"
#include "i2p.h"
#include "i2p/i2p_embedded.h"
#include "tor/onion_v3.h"
#include "tor/tor_embedded.h"
@@ -108,7 +108,7 @@ Value getinfo(const Array& params, bool fHelp)
if (onionAddress.empty())
onionAddress = CTorEmbedded::GetInstance()->GetOnionAddress();
obj.push_back(Pair("toraddress", onionAddress));
obj.push_back(Pair("i2paddress", CI2PSession::GetInstance()->GetB32Address()));
obj.push_back(Pair("i2paddress", CI2PEmbedded::GetInstance()->GetI2PAddress()));
diff.push_back(Pair("proof-of-work", GetDifficulty()));
diff.push_back(Pair("proof-of-stake", GetDifficulty(GetLastBlockIndex(pindexBest, true))));