mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
BugFix: Make initialfreecoins configurable, default of 0
This commit is contained in:
parent
864b122368
commit
5e97d95a28
8 changed files with 19 additions and 4 deletions
|
|
@ -37,3 +37,6 @@ validatepegin=1
|
|||
mainchainrpcport=18888
|
||||
mainchainrpcuser=user3
|
||||
mainchainrpcpassword=password3
|
||||
|
||||
# Free money to make testing easier
|
||||
initialfreecoins=2100000000000000
|
||||
|
|
|
|||
|
|
@ -16,3 +16,5 @@ mainchainrpcport=18888
|
|||
mainchainrpcuser=user3
|
||||
mainchainrpcpassword=password3
|
||||
validatepegin=1
|
||||
|
||||
initialfreecoins=2100000000000000
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ with open(os.path.join(sidechain_datadir, "elements.conf"), 'w') as f:
|
|||
f.write("connect=localhost:"+str(sidechain2_p2p_port)+"\n")
|
||||
f.write("listen=1\n")
|
||||
f.write("fallbackfee=0.0001\n")
|
||||
f.write("initialfreecoins=2100000000000000\n")
|
||||
|
||||
with open(os.path.join(sidechain2_datadir, "elements.conf"), 'w') as f:
|
||||
f.write("regtest=1\n")
|
||||
|
|
@ -137,6 +138,7 @@ with open(os.path.join(sidechain2_datadir, "elements.conf"), 'w') as f:
|
|||
f.write("connect=localhost:"+str(sidechain1_p2p_port)+"\n")
|
||||
f.write("listen=1\n")
|
||||
f.write("fallbackfee=0.0001\n")
|
||||
f.write("initialfreecoins=2100000000000000\n")
|
||||
|
||||
def test_pegout(parent_chain_addr, sidechain):
|
||||
pegout_txid = sidechain.sendtomainchain(parent_chain_addr, 1)
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ def initialize_datadir(dirname, n):
|
|||
f.write("port="+str(p2p_port(n))+"\n")
|
||||
f.write("rpcport="+str(rpc_port(n))+"\n")
|
||||
f.write("listenonion=0\n")
|
||||
f.write("initialfreecoins=2100000000000000\n")
|
||||
return datadir
|
||||
|
||||
def rpc_auth_pair(n):
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include "tinyformat.h"
|
||||
#include "util.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "amount.h"
|
||||
#include "crypto/sha256.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
|
@ -133,6 +132,7 @@ protected:
|
|||
consensus.mandatory_coinbase_destination = StrHexToScriptWithDefault(GetArg("-con_mandatorycoinbase", ""), CScript()); // Blank script allows any coinbase destination
|
||||
// bitcoin regtest is the parent chain by default
|
||||
parentGenesisBlockHash = uint256S(GetArg("-parentgenesisblockhash", "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
|
||||
initialFreeCoins = GetArg("-initialfreecoins", 0);
|
||||
|
||||
nDefaultPort = GetArg("-ndefaultport", 7042);
|
||||
nPruneAfterHeight = GetArg("-npruneafterheight", 1000);
|
||||
|
|
@ -174,7 +174,9 @@ public:
|
|||
CalculateAsset(consensus.pegged_asset, entropy);
|
||||
|
||||
genesis = CreateGenesisBlock(consensus, strNetworkID, 1296688602, genesisChallengeScript, 1);
|
||||
AppendInitialIssuance(genesis, COutPoint(uint256(commit), 0), parentGenesisBlockHash, 100, 21000000000000, 0, 0, CScript() << OP_TRUE);
|
||||
if (initialFreeCoins != 0) {
|
||||
AppendInitialIssuance(genesis, COutPoint(uint256(commit), 0), parentGenesisBlockHash, 100, initialFreeCoins/100, 0, 0, CScript() << OP_TRUE);
|
||||
}
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#ifndef BITCOIN_CHAINPARAMS_H
|
||||
#define BITCOIN_CHAINPARAMS_H
|
||||
|
||||
#include "amount.h"
|
||||
#include "chainparamsbase.h"
|
||||
#include "consensus/params.h"
|
||||
#include "primitives/block.h"
|
||||
|
|
@ -103,6 +104,7 @@ protected:
|
|||
std::string strNetworkID;
|
||||
CBlock genesis;
|
||||
uint256 parentGenesisBlockHash;
|
||||
CAmount initialFreeCoins;
|
||||
std::vector<SeedSpec6> vFixedSeeds;
|
||||
bool fMiningRequiresPeers;
|
||||
bool fDefaultConsistencyChecks;
|
||||
|
|
|
|||
|
|
@ -424,8 +424,6 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
{
|
||||
strUsage += HelpMessageOpt("-checkblocks=<n>", strprintf(_("How many blocks to check at startup (default: %u, 0 = all)"), DEFAULT_CHECKBLOCKS));
|
||||
strUsage += HelpMessageOpt("-checklevel=<n>", strprintf(_("How thorough the block verification of -checkblocks is (0-4, default: %u)"), DEFAULT_CHECKLEVEL));
|
||||
strUsage += HelpMessageOpt("-signblockscript=<hex>", _("Change chain to be signed and validated with a different script.") +
|
||||
" " + _(" This creates a new chain with a different genesis block."));
|
||||
strUsage += HelpMessageOpt("-checkblockindex", strprintf("Do a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive and mapBlocksUnlinked occasionally. Also sets -checkmempool (default: %u)", defaultChainParams->DefaultConsistencyChecks()));
|
||||
strUsage += HelpMessageOpt("-checkmempool=<n>", strprintf("Run checks every <n> transactions (default: %u)", defaultChainParams->DefaultConsistencyChecks()));
|
||||
strUsage += HelpMessageOpt("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", DEFAULT_CHECKPOINTS_ENABLED));
|
||||
|
|
@ -512,7 +510,10 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
if (showDebug) {
|
||||
strUsage += HelpMessageOpt("-fedpegscript=<hex>", _("Change federated peg to use a different script.") +
|
||||
" " + _("This creates a new chain with a different genesis block."));
|
||||
strUsage += HelpMessageOpt("-signblockscript=<hex>", _("Change chain to be signed and validated with a different script.") +
|
||||
" " + _(" This creates a new chain with a different genesis block."));
|
||||
strUsage += HelpMessageOpt("-peginconfirmationdepth", strprintf(_("Pegin claims must be this deep to be considered valid. (default: %d)"), DEFAULT_PEGIN_CONFIRMATION_DEPTH));
|
||||
strUsage += HelpMessageOpt("-initialfreecoins", strprintf(_("The amount of OP_TRUE coins created in the genesis block. Primarily for testing. (default: %d)"), 0));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-validatepegin", strprintf(_("Validate pegin claims. All functionaries must run this. (default: %u)"), DEFAULT_VALIDATE_PEGIN));
|
||||
strUsage += HelpMessageOpt("-mainchainrpchost=<addr>", strprintf("The address which the daemon will try to connect to validate peg-ins, if enabled. (default: cookie auth)"));
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::st
|
|||
if (!fedpegscript.empty()) {
|
||||
SoftSetArg("-fedpegscript", fedpegscript);
|
||||
}
|
||||
// MAX_MONEY
|
||||
SoftSetArg("-initialfreecoins", "2100000000000000");
|
||||
SelectParams(chainName);
|
||||
noui_connect();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue