Skip to content

Commit

Permalink
Chainparams: decouple anyonecanspend are mine from regtest
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimon committed Sep 28, 2017
1 parent 69fa8dd commit 998129b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions contrib/devtools/check-doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"')
REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")')
# list unsupported, deprecated and duplicate args as they need no documentation
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize',
'-con_fpowallowmindifficultyblocks', '-con_fpownoretargeting', '-con_nsubsidyhalvinginterval', '-con_bip34height', '-con_bip65height', '-con_bip66height', '-con_npowtargettimespan', '-con_npowtargetspacing', '-con_nrulechangeactivationthreshold', '-con_nminerconfirmationwindow', '-con_powlimit', '-con_bip34hash', '-con_nminimumchainwork', '-con_defaultassumevalid', '-ndefaultport', '-npruneafterheight', '-fdefaultconsistencychecks', '-frequirestandard', '-fmineblocksondemand', '-mainchainrpccookiefile', '-testnet', '-ct_bits', '-ct_exponent'])
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize'])

SET_DOC_OPTIONAL.update(['-con_fpowallowmindifficultyblocks', '-con_fpownoretargeting', '-con_nsubsidyhalvinginterval', '-con_bip34height', '-con_bip65height', '-con_bip66height', '-con_npowtargettimespan', '-con_npowtargetspacing', '-con_nrulechangeactivationthreshold', '-con_nminerconfirmationwindow', '-con_powlimit', '-con_bip34hash', '-con_nminimumchainwork', '-con_defaultassumevalid', '-ndefaultport', '-npruneafterheight', '-fdefaultconsistencychecks', '-frequirestandard', '-fmineblocksondemand', '-mainchainrpccookiefile', '-testnet', '-ct_bits', '-ct_exponent', '-anyonecanspendaremine'])

def main():
used = check_output(CMD_GREP_ARGS, shell=True)
Expand Down
3 changes: 3 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class CElementsParams : public CChainParams {
fDefaultConsistencyChecks = false;
fRequireStandard = true;
fMineBlocksOnDemand = false;
anyonecanspend_aremine = false;

checkpointData = (CCheckpointData){
boost::assign::map_list_of
Expand Down Expand Up @@ -271,6 +272,7 @@ class CRegTestParams : public CChainParams {
fDefaultConsistencyChecks = true;
fRequireStandard = false;
fMineBlocksOnDemand = true;
anyonecanspend_aremine = true;

checkpointData = (CCheckpointData){
boost::assign::map_list_of
Expand Down Expand Up @@ -324,6 +326,7 @@ class CCustomParams : public CChainParams {
fDefaultConsistencyChecks = GetBoolArg("-fdefaultconsistencychecks", true);
fRequireStandard = GetBoolArg("-frequirestandard", false);
fMineBlocksOnDemand = GetBoolArg("-fmineblocksondemand", true);
anyonecanspend_aremine = GetBoolArg("-anyonecanspendaremine", true);
}

public:
Expand Down
1 change: 1 addition & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class CChainParams
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
/** All coinbase outputs (after genesis) must be to this destination */
const CScript& CoinbaseDestination() const { return scriptCoinbaseDestination; }
bool anyonecanspend_aremine;
protected:
CChainParams() {}

Expand Down
2 changes: 1 addition & 1 deletion src/script/ismine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ isminetype IsMine(const CKeyStore &keystore, const CScript& scriptPubKey, bool&
break;
}
case TX_TRUE:
if (Params().NetworkIDString() == CHAINPARAMS_REGTEST)
if (Params().anyonecanspend_aremine)
return ISMINE_SPENDABLE;
}

Expand Down

0 comments on commit 998129b

Please sign in to comment.