mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-11 21:22:47 +01:00
net: distinguish default port per network
Change `CChainParams::GetDefaultPort()` to return 0 if the network is I2P.
This commit is contained in:
@@ -8,11 +8,13 @@
|
||||
|
||||
#include <chainparamsbase.h>
|
||||
#include <consensus/params.h>
|
||||
#include <netaddress.h>
|
||||
#include <primitives/block.h>
|
||||
#include <protocol.h>
|
||||
#include <util/hash_type.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
typedef std::map<int, uint256> MapCheckpoints;
|
||||
@@ -80,6 +82,15 @@ public:
|
||||
const Consensus::Params& GetConsensus() const { return consensus; }
|
||||
const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
|
||||
uint16_t GetDefaultPort() const { return nDefaultPort; }
|
||||
uint16_t GetDefaultPort(Network net) const
|
||||
{
|
||||
return net == NET_I2P ? I2P_SAM31_PORT : GetDefaultPort();
|
||||
}
|
||||
uint16_t GetDefaultPort(const std::string& addr) const
|
||||
{
|
||||
CNetAddr a;
|
||||
return a.SetSpecial(addr) ? GetDefaultPort(a.GetNetwork()) : GetDefaultPort();
|
||||
}
|
||||
|
||||
const CBlock& GenesisBlock() const { return genesis; }
|
||||
/** Default value for -checkmempool and -checkblockindex argument */
|
||||
|
||||
Reference in New Issue
Block a user