mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Add parent genesis hash to chainparams, simplify checks
This commit is contained in:
parent
99ca4d2120
commit
9f4ea3d03f
4 changed files with 13 additions and 11 deletions
|
|
@ -107,8 +107,8 @@ public:
|
|||
|
||||
CScript scriptChallenge(CScript() << OP_2 << ParseHex("03206b45265ae687dfdc602b8faa7dd749d7865b0e51f986e12c532229f0c998be") << ParseHex("0204c6be425356d9200a3303d95f2c39078cc9473ca49619da1e0ec233f27516ca") << ParseHex("02cc276552e180061f64dc16e2a02e7f9ecbcc744dea84eddbe991721824df825c") << OP_3 << OP_CHECKMULTISIG);
|
||||
|
||||
uint256 genesisBlockHash(uint256S("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
|
||||
CScript scriptDestination(CScript() << std::vector<unsigned char>(genesisBlockHash.begin(), genesisBlockHash.end()) << OP_WITHDRAWPROOFVERIFY);
|
||||
parentGenesisBlockHash = uint256S("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943");
|
||||
CScript scriptDestination(CScript() << std::vector<unsigned char>(parentGenesisBlockHash.begin(), parentGenesisBlockHash.end()) << OP_WITHDRAWPROOFVERIFY);
|
||||
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1231006505, scriptChallenge, 1, MAX_MONEY, 100);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
|
||||
|
|
@ -206,6 +206,8 @@ public:
|
|||
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1296688602, scriptDestination, 1, MAX_MONEY, 100);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
|
||||
parentGenesisBlockHash = uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206");
|
||||
|
||||
scriptCoinbaseDestination = CScript(); // Allow any coinbase destination
|
||||
|
||||
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public:
|
|||
int GetDefaultPort() const { return nDefaultPort; }
|
||||
|
||||
const CBlock& GenesisBlock() const { return genesis; }
|
||||
const uint256 ParentGenesisBlockHash() const { return parentGenesisBlockHash; }
|
||||
/** Make miner wait to have peers to avoid wasting work */
|
||||
bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
|
||||
/** Default value for -checkmempool and -checkblockindex argument */
|
||||
|
|
@ -98,6 +99,7 @@ protected:
|
|||
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
|
||||
std::string strNetworkID;
|
||||
CBlock genesis;
|
||||
uint256 parentGenesisBlockHash;
|
||||
std::vector<SeedSpec6> vFixedSeeds;
|
||||
bool fMiningRequiresPeers;
|
||||
bool fDefaultConsistencyChecks;
|
||||
|
|
|
|||
|
|
@ -2091,12 +2091,8 @@ bool BitcoindRPCCheck(bool init)
|
|||
return false;
|
||||
}
|
||||
UniValue result = reply["result"];
|
||||
if (GetBoolArg("-testnet", false) && result.isStr() && result.get_str() != "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943") { //FIXME: Stick parent chain(s) genesis in chainparams
|
||||
LogPrintf("ERROR: Invalid parent genesis block hash response via RPC. Contacting wrong parent daemon?");
|
||||
return false;
|
||||
}
|
||||
if (GetBoolArg("-regtest", false) && result.isStr() && result.get_str() != "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206") {
|
||||
LogPrintf("ERROR: Invalid parent genesis block hash response via RPC. Contacting wrong parent daemon?");
|
||||
if (!result.isStr() || result.get_str() != Params().ParentGenesisBlockHash().GetHex()) {
|
||||
LogPrintf("ERROR: Invalid parent genesis block hash response via RPC. Contacting wrong parent daemon?\n");
|
||||
return false;
|
||||
}
|
||||
} catch (const std::runtime_error& re) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "wallet.h"
|
||||
#include "walletdb.h"
|
||||
#include "merkleblock.h"
|
||||
|
||||
#include "chainparams.h"
|
||||
#include <secp256k1.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
|
@ -41,8 +41,6 @@ static CCriticalSection cs_nWalletUnlockTime;
|
|||
//Redeemscript template for alpha fedpeg
|
||||
static const CScript fedRedeemScript(CScript() << OP_2 << ParseHex("02d51090b27ca8f1cc04984614bd749d8bab6f2a3681318d3fd0dd43b2a39dd774") << ParseHex("034c55bede1bce8e486080f8ebb7a0e8f106b49efb295a8314da0e1b1723738c66") << ParseHex("03a75bd7ac458b19f98047c76a6ffa442e592148c5d23a1ec82d379d5d558f4fd8") << OP_3 << OP_CHECKMULTISIG);
|
||||
|
||||
static uint256 genesisBlockHash(uint256S("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
|
||||
|
||||
std::string HelpRequiringPassphrase()
|
||||
{
|
||||
return pwalletMain && pwalletMain->IsCrypted()
|
||||
|
|
@ -3284,6 +3282,8 @@ UniValue sendtomainchain(const JSONRPCRequest& request)
|
|||
hex.push_back((unsigned char)'H');
|
||||
hex.insert(hex.end(), vData.begin(), vData.end());
|
||||
|
||||
uint256 genesisBlockHash = Params().ParentGenesisBlockHash();
|
||||
|
||||
scriptPubKey << hex;
|
||||
scriptPubKey << OP_DROP;
|
||||
scriptPubKey << std::vector<unsigned char>(genesisBlockHash.begin(), genesisBlockHash.end());
|
||||
|
|
@ -3381,6 +3381,8 @@ UniValue claimpegin(const JSONRPCRequest& request)
|
|||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Failed to find output in bitcoinTx to the mainaddress from getpeginaddress");
|
||||
CAmount value = txBTC.vout[nOut].nValue.GetAmount();
|
||||
|
||||
uint256 genesisBlockHash = Params().ParentGenesisBlockHash();
|
||||
|
||||
//Output we're re-locking
|
||||
CScript relock_spk;
|
||||
relock_spk << std::vector<unsigned char>(genesisBlockHash.begin(), genesisBlockHash.end());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue