mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Merge 7791d31bcf into merged_master (Elements PR #1499)
This commit is contained in:
commit
9e5aaef647
13 changed files with 1392 additions and 26 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include <script/script.h>
|
||||
#include <uint256.h>
|
||||
#include <util/chaintype.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <issuance.h>
|
||||
#include <deploymentinfo.h>
|
||||
|
|
@ -249,6 +250,8 @@ public:
|
|||
multi_data_permitted = false;
|
||||
accept_discount_ct = false;
|
||||
create_discount_ct = false;
|
||||
pegin_subsidy = PeginSubsidy();
|
||||
pegin_minimum = PeginMinimum();
|
||||
consensus.has_parent_chain = false;
|
||||
g_signed_blocks = false;
|
||||
g_con_elementsmode = false;
|
||||
|
|
@ -394,6 +397,8 @@ public:
|
|||
multi_data_permitted = false;
|
||||
accept_discount_ct = false;
|
||||
create_discount_ct = false;
|
||||
pegin_subsidy = PeginSubsidy();
|
||||
pegin_minimum = PeginMinimum();
|
||||
consensus.has_parent_chain = false;
|
||||
g_signed_blocks = false;
|
||||
g_con_elementsmode = false;
|
||||
|
|
@ -557,6 +562,8 @@ public:
|
|||
multi_data_permitted = false;
|
||||
accept_discount_ct = false;
|
||||
create_discount_ct = false;
|
||||
pegin_subsidy = PeginSubsidy();
|
||||
pegin_minimum = PeginMinimum();
|
||||
consensus.has_parent_chain = false;
|
||||
g_signed_blocks = false; // lol
|
||||
g_con_elementsmode = false;
|
||||
|
|
@ -669,6 +676,8 @@ public:
|
|||
multi_data_permitted = false;
|
||||
accept_discount_ct = false;
|
||||
create_discount_ct = false;
|
||||
pegin_subsidy = PeginSubsidy();
|
||||
pegin_minimum = PeginMinimum();
|
||||
consensus.has_parent_chain = false;
|
||||
g_signed_blocks = false;
|
||||
g_con_elementsmode = false;
|
||||
|
|
@ -837,6 +846,38 @@ void UpdateActivationParametersFromArgs(const ArgsManager& args, Consensus::Par
|
|||
}
|
||||
}
|
||||
}
|
||||
// ELEMENTS
|
||||
PeginSubsidy ParsePeginSubsidy(const ArgsManager& args) {
|
||||
PeginSubsidy pegin_subsidy;
|
||||
|
||||
pegin_subsidy.height = args.GetIntArg("-peginsubsidyheight", std::numeric_limits<int>::max());
|
||||
if (pegin_subsidy.height < 0) {
|
||||
throw std::runtime_error(strprintf("Invalid block height (%d) for -peginsubsidyheight. Must be positive.", pegin_subsidy.height));
|
||||
}
|
||||
if (std::optional<CAmount> amount = ParseMoney(args.GetArg("-peginsubsidythreshold", "0"))) {
|
||||
pegin_subsidy.threshold = amount.value();
|
||||
} else {
|
||||
throw std::runtime_error("Invalid -peginsubsidythreshold");
|
||||
}
|
||||
|
||||
return pegin_subsidy;
|
||||
};
|
||||
|
||||
PeginMinimum ParsePeginMinimum(const ArgsManager& args) {
|
||||
PeginMinimum pegin_minimum;
|
||||
|
||||
pegin_minimum.height = args.GetIntArg("-peginminheight", std::numeric_limits<int>::max());
|
||||
if (pegin_minimum.height < 0) {
|
||||
throw std::runtime_error(strprintf("Invalid block height (%d) for -peginminheight. Must be positive.", pegin_minimum.height));
|
||||
}
|
||||
if (std::optional<CAmount> amount = ParseMoney(args.GetArg("-peginminamount", "0"))) {
|
||||
pegin_minimum.amount = amount.value();
|
||||
} else {
|
||||
throw std::runtime_error("Invalid -peginminamount");
|
||||
}
|
||||
|
||||
return pegin_minimum;
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom params for testing.
|
||||
|
|
@ -976,6 +1017,11 @@ protected:
|
|||
consensus.start_p2wsh_script = args.GetIntArg("-con_start_p2wsh_script", consensus.start_p2wsh_script);
|
||||
create_discount_ct = args.GetBoolArg("-creatediscountct", create_discount_ct);
|
||||
accept_discount_ct = args.GetBoolArg("-acceptdiscountct", accept_discount_ct) || create_discount_ct;
|
||||
pegin_subsidy = ParsePeginSubsidy(args);
|
||||
pegin_minimum = ParsePeginMinimum(args);
|
||||
if (pegin_subsidy.threshold < pegin_minimum.amount) {
|
||||
throw std::runtime_error(strprintf("Peg-in subsidy threshold (%s) must be greater than or equal to peg-in minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
|
||||
}
|
||||
|
||||
// Calculate pegged Bitcoin asset
|
||||
std::vector<unsigned char> commit = CommitToArguments(consensus, m_chain_type.chain_name);
|
||||
|
|
@ -1219,6 +1265,11 @@ public:
|
|||
multi_data_permitted = true;
|
||||
create_discount_ct = args.GetBoolArg("-creatediscountct", false);
|
||||
accept_discount_ct = args.GetBoolArg("-acceptdiscountct", true) || create_discount_ct;
|
||||
pegin_subsidy = ParsePeginSubsidy(args);
|
||||
pegin_minimum = ParsePeginMinimum(args);
|
||||
if (pegin_subsidy.threshold < pegin_minimum.amount) {
|
||||
throw std::runtime_error(strprintf("Peg-in subsidy threshold (%s) must be greater than or equal to peg-in minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
|
||||
}
|
||||
|
||||
parentGenesisBlockHash = uint256S("000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
|
||||
const bool parent_genesis_is_null = parentGenesisBlockHash == uint256();
|
||||
|
|
@ -1574,6 +1625,11 @@ public:
|
|||
multi_data_permitted = args.GetBoolArg("-multi_data_permitted", multi_data_permitted);
|
||||
create_discount_ct = args.GetBoolArg("-creatediscountct", create_discount_ct);
|
||||
accept_discount_ct = args.GetBoolArg("-acceptdiscountct", accept_discount_ct) || create_discount_ct;
|
||||
pegin_subsidy = ParsePeginSubsidy(args);
|
||||
pegin_minimum = ParsePeginMinimum(args);
|
||||
if (pegin_subsidy.threshold < pegin_minimum.amount) {
|
||||
throw std::runtime_error(strprintf("Peg-in subsidy threshold (%s) must be greater than or equal to peg-in minimum amount (%s)", FormatMoney(pegin_subsidy.threshold), FormatMoney(pegin_minimum.amount)));
|
||||
}
|
||||
|
||||
if (args.IsArgSet("-parentgenesisblockhash")) {
|
||||
parentGenesisBlockHash = uint256S(args.GetArg("-parentgenesisblockhash", ""));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue