From 2ba053f7af7a800f5865313bdb99b7d9f89d7c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Wed, 3 May 2017 00:46:22 +0200 Subject: [PATCH 1/2] Document -validatepegin in daemon help --- src/init.cpp | 3 +++ src/main.cpp | 2 +- src/script/interpreter.cpp | 2 +- src/script/script.h | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index b377f1e3968..74d91ebee7b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -482,6 +482,9 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-rpcservertimeout=", strprintf("Timeout during HTTP requests (default: %d)", DEFAULT_HTTP_SERVER_TIMEOUT)); } + strUsage += HelpMessageGroup(_("Federated peg options:")); + strUsage += HelpMessageOpt("-validatepegin", strprintf(_("Validate pegin claims. All functionaries must run this. (default: %u)"), DEFAULT_VALIDATE_PEGIN)); + return strUsage; } diff --git a/src/main.cpp b/src/main.cpp index a92303b7b47..df48e4f3080 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2944,7 +2944,7 @@ bool BitcoindRPCCheck(const bool init) pblocktree->WriteInvalidBlockQueue(vblocksToReconsider); //Next, check for working rpc - if (GetBoolArg("-validatepegin", false)) { + if (GetBoolArg("-validatepegin", DEFAULT_VALIDATE_PEGIN)) { // During init try until a non-RPC_IN_WARMUP result while (true) { try { diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index bbd0c0eff6c..29c5018b309 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1580,7 +1580,7 @@ bool EvalScript(vector >& stack, const CScript& script, un return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_SCRIPT); #ifndef BITCOIN_SCRIPT_NO_CALLRPC - if (GetBoolArg("-validatepegin", false) && !checker.IsConfirmedBitcoinBlock(genesishash, merkleBlock.header.GetHash(), flags & SCRIPT_VERIFY_INCREASE_CONFIRMATIONS_REQUIRED)) + if (GetBoolArg("-validatepegin", DEFAULT_VALIDATE_PEGIN) && !checker.IsConfirmedBitcoinBlock(genesishash, merkleBlock.header.GetHash(), flags & SCRIPT_VERIFY_INCREASE_CONFIRMATIONS_REQUIRED)) return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_BLOCKCONFIRMED); #endif } catch (std::exception& e) { diff --git a/src/script/script.h b/src/script/script.h index 1cb0dcb16ac..92e8dc8b668 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -27,6 +27,10 @@ static const int MAX_OPS_PER_SCRIPT = 201; // Maximum number of public keys per multisig static const int MAX_PUBKEYS_PER_MULTISIG = 20; +// Validate pegin proof by checking Bitcoin transaction inclusion in +// mainchain. +static const bool DEFAULT_VALIDATE_PEGIN = false; + // Maximum script length in bytes static const int MAX_SCRIPT_SIZE = 10000; class uint256; From b663091dccc1ebc7329c55b80e5aa676e82ca220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Wed, 3 May 2017 00:46:42 +0200 Subject: [PATCH 2/2] Document -signblockscript and -fedpegscript in daemon help --- src/init.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 74d91ebee7b..66cdfeee13f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -403,6 +403,8 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-uacomment=", _("Append comment to the user agent string")); if (showDebug) { + strUsage += HelpMessageOpt("-signblockscript=", _("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=", strprintf("Run checks every transactions (default: %u)", defaultChainParams->DefaultConsistencyChecks())); strUsage += HelpMessageOpt("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", DEFAULT_CHECKPOINTS_ENABLED)); @@ -483,6 +485,10 @@ std::string HelpMessage(HelpMessageMode mode) } strUsage += HelpMessageGroup(_("Federated peg options:")); + if (showDebug) { + strUsage += HelpMessageOpt("-fedpegscript=", _("Change federated peg to use a different script.") + + " " + _("This creates a new chain with a different genesis block.")); + } strUsage += HelpMessageOpt("-validatepegin", strprintf(_("Validate pegin claims. All functionaries must run this. (default: %u)"), DEFAULT_VALIDATE_PEGIN)); return strUsage;