Merge ElementsProject/elements#986: Undo default signalling behavior for dynafed unless enabled

b7a116d910 Undo default signalling behavior for dynafed unless enabled (Steven Roose)

Pull request description:

  This adds an explicit argument to enable dynafed signalling that is not active by default.

ACKs for top commit:
  gwillen:
    That looks great, utACK b7a116d.

Tree-SHA512: bf13ff2b0a8b2cb1d5570ef8f5c423c3b112249d08407791fdca9a86ab7759dd37aa28edce14b5c8600bf22f100472515bed465243253fefd3f51ce9782e9210
This commit is contained in:
Steven Roose 2021-05-10 12:05:53 +02:00
commit 3172615d2c
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
6 changed files with 31 additions and 4 deletions

View file

@ -57,6 +57,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
argsman.AddArg("-multi_data_permitted", "Allow relay of multiple OP_RETURN outputs. (default: -enforce_pak)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_csv_deploy_start", "Starting height for CSV deployment. (default: -1, which means ACTIVE from genesis)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_dyna_deploy_start", "Starting height for Dynamic Federations deployment. Once active, signblockscript becomes a BIP141 WSH scriptPubKey of the original signblockscript. All other dynamic parameters stay constant.(default: -1, which means ACTIVE from genesis)", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-con_dyna_deploy_signal", "Whether to signal for the Dynamic Federations deployment (default: false).", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-dynamic_epoch_length", "Per-chain parameter that sets how many blocks dynamic federation voting and enforcement are in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
argsman.AddArg("-total_valid_epochs", "Per-chain parameter that sets how long a particular fedpegscript is in effect for.", ArgsManager::ALLOW_ANY, OptionsCategory::ELEMENTS);
// END ELEMENTS

View file

@ -1969,6 +1969,15 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
}
}
// Undo default signalling behavior for dynafed unless explicitly enabled.
if (!gArgs.GetBoolArg("-con_dyna_deploy_signal", false)) {
auto dynafed = Consensus::DeploymentPos::DEPLOYMENT_DYNA_FED;
int bit = params.vDeployments[dynafed].bit;
if (bit > 0 && bit < VERSIONBITS_NUM_BITS) {
nVersion &= ~VersionBitsMask(params, dynafed);
}
}
return nVersion;
}

View file

@ -83,6 +83,7 @@ class BlockSignTest(BitcoinTestFramework):
"-con_max_block_sig_size={}".format(self.required_signers*74+self.num_nodes*33),
"-anyonecanspendaremine=1",
"-con_dyna_deploy_start=0",
"-con_dyna_deploy_signal=1",
]] * self.num_nodes
def setup_network(self):

View file

@ -66,7 +66,15 @@ class DynaFedTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 2
# We want to test activation of dynafed
self.extra_args = [["-con_dyna_deploy_start=1000", "-enforce_pak=1", "-con_parent_chain_signblockscript=51", "-peginconfirmationdepth=1", "-parentscriptprefix=75", "-parent_bech32_hrp=ert"] for i in range(self.num_nodes)]
self.extra_args = [[
"-con_dyna_deploy_start=1000",
"-enforce_pak=1",
"-con_parent_chain_signblockscript=51",
"-peginconfirmationdepth=1",
"-parentscriptprefix=75",
"-parent_bech32_hrp=ert",
"-con_dyna_deploy_signal=1",
] for i in range(self.num_nodes)]
# second node will not mine transactions
self.extra_args[1].append("-blocksonly=1")
# Make sure nothing breaks if peers have a different activation.

View file

@ -50,8 +50,15 @@ class SighashRangeproofTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 3
# We want to test activation of dynafed
args = ["-con_dyna_deploy_start=1000", "-blindedaddresses=1", "-initialfreecoins=2100000000000000", "-con_blocksubsidy=0", "-con_connect_genesis_outputs=1", "-txindex=1"]
self.extra_args = [args] * self.num_nodes
self.extra_args = [[
"-con_dyna_deploy_start=1000",
"-con_dyna_deploy_signal=1",
"-blindedaddresses=1",
"-initialfreecoins=2100000000000000",
"-con_blocksubsidy=0",
"-con_connect_genesis_outputs=1",
"-txindex=1",
]] * self.num_nodes
self.extra_args[0].append("-anyonecanspendaremine=1") # first node gets the coins
def skip_test_if_missing_module(self):

View file

@ -25,7 +25,8 @@ class TweakFedpegTest(BitcoinTestFramework):
],
[
"-fedpegscript="+LIQUID_SCRIPT,
"-con_dyna_deploy_start=0" # test dynafed derivation
"-con_dyna_deploy_signal=1",
"-con_dyna_deploy_start=0", # test dynafed derivation
]]
def setup_network(self):