Add not yet enforced chainparam arguments for signed blocks

This commit is contained in:
Gregory Sanders 2018-12-05 20:31:36 +01:00
parent 7bc578a398
commit f7c5cf7d92
4 changed files with 14 additions and 0 deletions

View file

@ -478,6 +478,13 @@ class CCustomParams : public CRegTestParams {
// Determines type of genesis block
consensus.genesis_style = gArgs.GetArg("-con_genesis_style", "elements");
// Block signing encumberance script, default of 51 aka OP_TRUE
std::vector<unsigned char> sign_bytes = ParseHex(gArgs.GetArg("-signblockscript", "51"));
consensus.signblockscript = CScript(sign_bytes.begin(), sign_bytes.end());
// Default signature size is the size of dummy push, and single 72 byte DER signature
consensus.max_block_signature_size = gArgs.GetArg("-con_max_block_sig_size", 74);
g_signed_blocks = gArgs.GetBoolArg("-con_signed_blocks", false);
// Custom chains connect coinbase outputs to db by default
consensus.connect_genesis_outputs = gArgs.GetArg("-con_connect_coinbase", true);

View file

@ -28,6 +28,9 @@ void SetupChainParamsBaseOptions()
gArgs.AddArg("-con_connect_coinbase", "Connect outputs in genesis block to utxo database.", 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);
gArgs.AddArg("-signblockscript", "Signed blockchain enumberance. Only active when `-con_signed_blocks` set to true.", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-con_max_block_sig_size", "Max allowed witness data for the signed block header.", false, OptionsCategory::CHAINPARAMS);
}
static std::unique_ptr<CBaseChainParams> globalChainBaseParams;

View file

@ -84,6 +84,9 @@ struct Params {
bool connect_genesis_outputs;
// g_con_blockheightinheader global hack instead of proper arg due to circular dep
std::string genesis_style;
CScript signblockscript;
uint32_t max_block_signature_size;
// g_signed_blocks - Whether blocks are signed or not, get around circular dep
};
} // namespace Consensus

View file

@ -11,6 +11,7 @@
#include <crypto/common.h>
bool g_con_blockheightinheader = false;
bool g_signed_blocks = false;
uint256 CBlockHeader::GetHash() const
{