Add -con_elementswitness flag and global variable

This commit is contained in:
Steven Roose 2019-01-29 12:24:13 +00:00
parent 01b03a9206
commit 6ed8fd8ab0
6 changed files with 14 additions and 2 deletions

View file

@ -7,6 +7,7 @@
#include <chainparamsseeds.h>
#include <consensus/merkle.h>
#include <primitives/transaction.h>
#include <tinyformat.h>
#include <util.h>
#include <utilstrencodings.h>
@ -523,9 +524,10 @@ class CCustomParams : public CRegTestParams {
consensus.max_block_signature_size = gArgs.GetArg("-con_max_block_sig_size", 74);
g_signed_blocks = gArgs.GetBoolArg("-con_signed_blocks", true);
// Note: This global is needed to avoid circular dependency
// Defaults to true for custom chains.
// Note: These globals are needed to avoid circular dependencies.
// Default to true for custom chains.
g_con_blockheightinheader = args.GetBoolArg("-con_blockheightinheader", true);
g_con_elementswitness = args.GetBoolArg("-con_elementswitness", true);
// No subsidy for custom chains by default
consensus.genesis_subsidy = args.GetArg("-con_blocksubsidy", 0);

View file

@ -26,6 +26,7 @@ void SetupChainParamsBaseOptions()
gArgs.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", false, OptionsCategory::ELEMENTS);
gArgs.AddArg("-con_blocksubsidy", "Defines the amount of block subsidy to start with, at genesis block.", false, OptionsCategory::ELEMENTS);
gArgs.AddArg("-con_connect_coinbase", "Connect outputs in genesis block to utxo database.", false, OptionsCategory::ELEMENTS);
gArgs.AddArg("-con_elementswitness", "Use Elements-like instead of Core-like witness encoding. This is required for CA/CT. (default: true)", false, OptionsCategory::ELEMENTS);
gArgs.AddArg("-con_blockheightinheader", "Whether the chain includes the block height directly in the header, for easier validation of block height in low-resource environments. (default: true)", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-con_genesis_style=<style>", "Use genesis style <style> (default: elements). Results in genesis block compatibility with various networks. Allowed values: elements, bitcoin", true, OptionsCategory::ELEMENTS);
gArgs.AddArg("-con_signed_blocks", "Signed blockchain. Uses input of `-signblockscript` to define what signatures are necessary to solve it.", false, OptionsCategory::CHAINPARAMS);

View file

@ -11,6 +11,8 @@
#include <serialize.h>
#include <uint256.h>
// ELEMENTS:
// Globals to avoid circular dependencies.
extern bool g_con_blockheightinheader;
extern bool g_signed_blocks;

View file

@ -9,6 +9,8 @@
#include <tinyformat.h>
#include <utilstrencodings.h>
bool g_con_elementswitness = false;
std::string COutPoint::ToString() const
{
return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10), n);

View file

@ -14,6 +14,10 @@
static const int SERIALIZE_TRANSACTION_NO_WITNESS = 0x40000000;
// ELEMENTS:
// Globals to avoid circular dependencies.
extern bool g_con_elementswitness;
/** An outpoint - a combination of a transaction hash and an index n into its vout */
class COutPoint
{

View file

@ -307,6 +307,7 @@ def initialize_datadir(dirname, n, chain):
f.write("con_connect_coinbase=0\n")
f.write("anyonecanspendaremine=0\n")
f.write("con_blockheightinheader=0\n")
f.write("con_elementswitness=0\n")
f.write("con_signed_blocks=0\n")
f.write("multi_data_permitted=0\n")
f.write("walletrbf=0\n") # Default is 1 in Elements