mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge fc06881f13 into merged_master (Bitcoin PR bitcoin/bitcoin#27491)
This commit is contained in:
commit
cbd7b123d9
93 changed files with 546 additions and 303 deletions
|
|
@ -7,19 +7,10 @@
|
|||
|
||||
#include <common/args.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/chaintype.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
const std::string CBaseChainParams::MAIN = "main";
|
||||
const std::string CBaseChainParams::TESTNET = "test";
|
||||
const std::string CBaseChainParams::SIGNET = "signet";
|
||||
const std::string CBaseChainParams::REGTEST = "regtest";
|
||||
const std::string CBaseChainParams::LIQUID1 = "liquidv1";
|
||||
const std::string CBaseChainParams::LIQUID1TEST = "liquidv1test";
|
||||
const std::string CBaseChainParams::LIQUIDTESTNET = "liquidtestnet";
|
||||
|
||||
const std::string CBaseChainParams::DEFAULT = CBaseChainParams::LIQUID1;
|
||||
|
||||
void SetupChainParamsBaseOptions(ArgsManager& argsman)
|
||||
{
|
||||
argsman.AddArg("-chain=<chain>", "Use the chain <chain> (default: liquidv1). Reserved values: main, test, signet, regtest, liquidv1, liquidv1test", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
|
|
@ -77,30 +68,39 @@ const CBaseChainParams& BaseParams()
|
|||
* Port numbers for incoming Tor connections (8334, 18334, 38334, 18445) have
|
||||
* been chosen arbitrarily to keep ranges of used ports tight.
|
||||
*/
|
||||
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
|
||||
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainTypeMeta chain)
|
||||
{
|
||||
if (chain == CBaseChainParams::MAIN) {
|
||||
switch (chain.chain_type) {
|
||||
case ChainType::MAIN:
|
||||
return std::make_unique<CBaseChainParams>("", 8332, 18332, 8334);
|
||||
} else if (chain == CBaseChainParams::TESTNET) {
|
||||
case ChainType::TESTNET:
|
||||
return std::make_unique<CBaseChainParams>("testnet3", 18332, 8332, 18334);
|
||||
} else if (chain == CBaseChainParams::SIGNET) {
|
||||
case ChainType::SIGNET:
|
||||
return std::make_unique<CBaseChainParams>("signet", 38332, 18332, 38334);
|
||||
} else if (chain == CBaseChainParams::REGTEST) {
|
||||
case ChainType::REGTEST:
|
||||
return std::make_unique<CBaseChainParams>("regtest", 18443, 18332, 18445);
|
||||
} else if (chain == CBaseChainParams::LIQUID1) {
|
||||
case ChainType::LIQUID1:
|
||||
return std::make_unique<CBaseChainParams>("liquidv1", 7041, 8332, 37041);
|
||||
} else if (chain == CBaseChainParams::LIQUID1TEST) {
|
||||
case ChainType::LIQUID1TEST:
|
||||
return std::make_unique<CBaseChainParams>("liquidv1test", 7040, 18332, 37040); // Use same ports as customparams
|
||||
} else if (chain == CBaseChainParams::LIQUIDTESTNET) {
|
||||
return std::make_unique<CBaseChainParams>(chain, 7039, 18331, 37039);
|
||||
case ChainType::LIQUIDTESTNET:
|
||||
return std::make_unique<CBaseChainParams>("liquidtestnet", 7039, 18331, 37039);
|
||||
case ChainType::CUSTOM:
|
||||
return std::make_unique<CBaseChainParams>(chain.chain_name, 7040, 18332, 37040);
|
||||
}
|
||||
|
||||
// ELEMENTS:
|
||||
return std::make_unique<CBaseChainParams>(chain, 7040, 18332, 37040);
|
||||
return std::make_unique<CBaseChainParams>(chain.chain_name, 7040, 18332, 37040);
|
||||
}
|
||||
|
||||
void SelectBaseParams(const std::string& chain)
|
||||
void SelectBaseParams(const ChainTypeMeta chain)
|
||||
{
|
||||
globalChainBaseParams = CreateBaseChainParams(chain);
|
||||
gArgs.SelectConfigNetwork(chain);
|
||||
gArgs.SelectConfigNetwork(chain.chain_name);
|
||||
}
|
||||
|
||||
// ELEMENTS
|
||||
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainType chain) {
|
||||
return CreateBaseChainParams(ChainTypeMetaFrom(chain));
|
||||
}
|
||||
void SelectBaseParams(const ChainType chain) {
|
||||
SelectBaseParams(ChainTypeMetaFrom(chain));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue