From 40a32c94c7c53d93e2c2ade4a8ffe60db2af668f Mon Sep 17 00:00:00 2001 From: Liquid Date: Fri, 21 Oct 2022 18:40:10 -0500 Subject: [PATCH 1/5] Account for switchover let stratums connect --- src/chainparams.cpp | 2 +- src/miner.cpp | 6 +++++- src/primitives/block.cpp | 18 +++++------------- src/rpc/mining.cpp | 4 ++-- src/validation.cpp | 12 +++--------- 5 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 981db4d5155f..54ab6db9482f 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -202,7 +202,7 @@ class CMainParams : public CChainParams { /** Prog PoW **/ consensus.nPPSwitchHeight = 490000; //placeholder set to disconnect peers. consensus.nPPSwitchTime = 1666350000; // Friday, October 21, 2022 11:00:00 AM GMT - consensus.nInitialPPDifficulty = 0x1b1774cd; // 40GH/s + consensus.nInitialPPDifficulty = 0x1d00dade; // ~1 MH/s consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 diff --git a/src/miner.cpp b/src/miner.cpp index ba85ed7a4430..b07e70a4ce64 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -218,7 +218,11 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev); - pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus()); + if (nHeight == 491409) { + pblock->nBits = chainparams.GetConsensus().nInitialPPDifficulty; + } else { + pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus()); + } pblock->nNonce = 0; pblock->nNonce64 = 0; pblock->nHeight = nHeight; diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 6a2f8a3b13b5..2698a7d98559 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -22,17 +22,14 @@ uint256 CBlockHeader::GetHashFull(uint256& mix_hash) const { uint256 CBlockHeader::GetPoWHash(int nHeight) const { - uint256 powHash, mix_hash; + uint256 powHash; std::vector vch(80); CVectorWriter ss(SER_GETHASH, PROTOCOL_VERSION, vch, 0); ss << *this; if(nHeight == 0) { return HashX11((const char *)vch.data(), (const char *)vch.data() + vch.size()); } - if (IsFirstProgPow()) { - powHash = progpow_hash_full(GetProgPowHeader(), mix_hash); - return powHash; - } else if (IsProgPow()) { + if (IsProgPow()) { powHash = progpow_hash_light(GetProgPowHeader()); return powHash; } else { @@ -47,7 +44,7 @@ bool CBlockHeader::IsProgPow() const { } bool CBlockHeader::IsFirstProgPow() const { - return (IsProgPow() && nTime <= (Params().GetConsensus().nPPSwitchTime + 432000)); //1 hr 45 mins ish + return (IsProgPow() && nTime <= (Params().GetConsensus().nPPSwitchTime + 432000)); //5 days } CProgPowHeader CBlockHeader::GetProgPowHeader() const { @@ -79,13 +76,8 @@ uint256 CBlockHeader::GetProgPowHashLight() const { uint256 CBlockHeader::GetHash() const { uint256 powHash; if (IsProgPow()) { - if(IsFirstProgPow()) { - uint256 mix_hash = Params().GetConsensus().powLimit; - powHash = progpow_hash_full(GetProgPowHeader(), mix_hash); - } else { - powHash = progpow_hash_light(GetProgPowHeader()); - } - return powHash; + powHash = progpow_hash_light(GetProgPowHeader()); + return powHash; } else { std::vector vch(80); CVectorWriter ss(SER_GETHASH, PROTOCOL_VERSION, vch, 0); diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index e21a70c6650b..122749c42c9c 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -500,8 +500,8 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) if (chain != CBaseChainParams::TESTNET) { if (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, PACKAGE_NAME " is not connected!"); - - if (::ChainstateActive().IsInitialBlockDownload()) + + if (::ChainstateActive().IsInitialBlockDownload() && ::ChainActive().Height() != 491408) throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks..."); // next block is a superblock and we need governance info to correctly construct it diff --git a/src/validation.cpp b/src/validation.cpp index 46066d79aa0a..98da0b11a150 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1942,12 +1942,6 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl if (block.IsProgPow() && !fJustCheck) { if (block.nHeight >= progpow::epoch_length*2000) return state.DoS(50, false, REJECT_INVALID, "invalid-progpow-epoch", false, "invalid epoch number"); - - uint256 exp_mix_hash, final_hash; - final_hash = block.GetProgPowHashFull(exp_mix_hash); - if (exp_mix_hash != block.mix_hash) { - return state.DoS(50, false, REJECT_INVALID, "invalid-mixhash", false, "mix_hash validity failed"); - } } // verify that the view's current state corresponds to the previous block @@ -3780,10 +3774,10 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationSta // check for version 2, 3 and 4 upgrades if((block.nVersion < 2 && nHeight >= consensusParams.BIP34Height) || - (block.nVersion < 3 && nHeight >= consensusParams.BIP66Height) || - (block.nVersion < 4 && nHeight >= consensusParams.BIP65Height)) + (block.nVersion < 3 && nHeight >= consensusParams.BIP66Height) || + (block.nVersion < 4 && nHeight >= consensusParams.BIP65Height)) return state.Invalid(false, REJECT_OBSOLETE, strprintf("bad-version(0x%08x)", block.nVersion), - strprintf("rejected nVersion=0x%08x block", block.nVersion)); + strprintf("rejected nVersion=0x%08x block", block.nVersion)); return true; } From 9bc567e5c740fe6328ff2091d279bdf2d99459fd Mon Sep 17 00:00:00 2001 From: Liquid Date: Sat, 22 Oct 2022 04:58:00 -0500 Subject: [PATCH 2/5] change diff --- src/chainparams.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 54ab6db9482f..7016b0b53575 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -202,7 +202,7 @@ class CMainParams : public CChainParams { /** Prog PoW **/ consensus.nPPSwitchHeight = 490000; //placeholder set to disconnect peers. consensus.nPPSwitchTime = 1666350000; // Friday, October 21, 2022 11:00:00 AM GMT - consensus.nInitialPPDifficulty = 0x1d00dade; // ~1 MH/s + consensus.nInitialPPDifficulty = 0x1d016e81; // ~10 MH/s consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008 From 5e0597a536e7191d322ebcc10de6fa5cd8b61285 Mon Sep 17 00:00:00 2001 From: Liquid Date: Sat, 22 Oct 2022 10:16:15 -0500 Subject: [PATCH 3/5] Kick versioning --- src/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/version.h b/src/version.h index bbdc3edf7b6f..103fb5549b16 100644 --- a/src/version.h +++ b/src/version.h @@ -10,7 +10,7 @@ * network protocol versioning */ //! client proto version -static const int PROTOCOL_VERSION = 70222; +static const int PROTOCOL_VERSION = 70223; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -19,7 +19,7 @@ static const int INIT_PROTO_VERSION = 209; static const int MIN_PEER_PROTO_VERSION = 70221; //! minimum proto for ProgPow -static const int MIN_PP_PROTO_VERSION = 70222; +static const int MIN_PP_PROTO_VERSION = 70223; //! minimum proto version of masternode to accept in DKGs static const int MIN_MASTERNODE_PROTO_VERSION = 70219; From 60c378015e4d2dae0588d1df9259482f4052bd19 Mon Sep 17 00:00:00 2001 From: Liquid Date: Sat, 22 Oct 2022 11:06:15 -0500 Subject: [PATCH 4/5] Adjust RPC --- src/rpc/blockchain.cpp | 2 +- src/rpc/client.cpp | 4 +++- src/rpc/mining.cpp | 6 ++++-- src/wallet/rpcwallet.cpp | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 0db8a7566453..47e60aad5ece 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2736,7 +2736,7 @@ static const CRPCCommand commands[] = { "blockchain", "getbestblockhash", &getbestblockhash, {} }, { "blockchain", "getbestchainlock", &getbestchainlock, {} }, { "blockchain", "getblockcount", &getblockcount, {} }, - { "blockchain", "getblock", &getblock, {"blockhash","verbosity|verbose"} }, + { "blockchain", "getblock", &getblock, {"blockhash","verbosity"} }, { "blockchain", "getblockhashes", &getblockhashes, {"high","low"} }, { "blockchain", "getblockhash", &getblockhash, {"height"} }, { "blockchain", "getblockheader", &getblockheader, {"blockhash","verbose"} }, diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index aea8dca61d99..11f4627d75a5 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -41,7 +41,8 @@ static const CRPCConvertParam vRPCConvertParams[] = { "sendtoaddress", 6, "use_cj" }, { "sendtoaddress", 7, "conf_target" }, { "settxfee", 0, "amount" }, - { "burn", 0 }, + { "burn", 0, "amount" }, + { "burn", 1, "data" }, { "getreceivedbyaddress", 1, "minconf" }, { "getreceivedbyaddress", 2, "addlocked" }, { "getreceivedbylabel", 1, "minconf" }, @@ -72,6 +73,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "walletpassphrase", 1, "timeout" }, { "walletpassphrase", 2, "mixingonly" }, { "getblocktemplate", 0, "template_request" }, + { "getblocktemplate", 1, "reward_address" }, { "listsinceblock", 1, "target_confirmations" }, { "listsinceblock", 2, "include_watchonly" }, { "listsinceblock", 3, "include_removed" }, diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 122749c42c9c..8b54e9b17ced 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -352,7 +352,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) }, }, "\"template_request\""}, - {"reward_address", RPCArg::Type::STR, "", "Address to place into Coinbase", + {"reward_address", RPCArg::Type::OBJ, "", "Address to place into Coinbase", { {"address", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "address for reward in coinbase (meaningful only if block solution is later submitted with pprpcsb)\n}"} }, @@ -422,7 +422,9 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) }, RPCExamples{ HelpExampleCli("getblocktemplate", "") + + HelpExampleCli("getblocktemplate", "\"template\", \"sfWnK8nQQFodqEuqoVN2e9AK8GoAEU2nHN\"") + HelpExampleRpc("getblocktemplate", "") + + HelpExampleRpc("getblocktemplate", "\"template\", \"sfWnK8nQQFodqEuqoVN2e9AK8GoAEU2nHN\"") }, }.ToString()); @@ -1180,7 +1182,7 @@ static const CRPCCommand commands[] = { "mining", "getnetworkhashps", &getnetworkhashps, {"nblocks","height"} }, { "mining", "getmininginfo", &getmininginfo, {} }, { "mining", "prioritisetransaction", &prioritisetransaction, {"txid","fee_delta"} }, - { "mining", "getblocktemplate", &getblocktemplate, {"template_request"} }, + { "mining", "getblocktemplate", &getblocktemplate, {"template_request", "reward_address"} }, { "mining", "pprpcsb", &pprpcsb, {"header_hash","mix_hash", "nonce"} }, { "mining", "submitblock", &submitblock, {"hexdata","dummy"} }, { "mining", "submitheader", &submitheader, {"hexdata"} }, diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 20ca9bafc584..06098aeb52f3 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4284,10 +4284,10 @@ static const CRPCCommand commands[] = { "hidden", "generate", &generate, {"nblocks","maxtries"} }, // Hidden as it isn't functional, just an error to let people know if miner isn't compiled #endif //ENABLE_MINER { "hidden", "instantsendtoaddress", &instantsendtoaddress, {} }, + { "hidden", "burn", &burn, {"amount","text"} }, { "rawtransactions", "fundrawtransaction", &fundrawtransaction, {"hexstring","options"} }, { "wallet", "abandontransaction", &abandontransaction, {"txid"} }, { "wallet", "abortrescan", &abortrescan, {} }, - { "wallet", "burn", &burn, {"amount","text"} }, { "wallet", "addmultisigaddress", &addmultisigaddress, {"nrequired","keys","label"} }, { "wallet", "backupwallet", &backupwallet, {"destination"} }, { "wallet", "createwallet", &createwallet, {"wallet_name", "disable_private_keys", "blank", "passphrase"} }, From 770dbf185eab50f8b69558b2f6c8e46ce06814c9 Mon Sep 17 00:00:00 2001 From: Liquid Date: Sat, 22 Oct 2022 11:39:29 -0500 Subject: [PATCH 5/5] 3.3.1 --- configure.ac | 2 +- src/chainparams.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 50545ede35c7..3b57ba101775 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.69]) define(_CLIENT_VERSION_MAJOR, 3) define(_CLIENT_VERSION_MINOR, 3) -define(_CLIENT_VERSION_REVISION, 0) +define(_CLIENT_VERSION_REVISION, 1) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_RC, 0) define(_CLIENT_VERSION_IS_RELEASE, true) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 7016b0b53575..981db4d5155f 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -202,7 +202,7 @@ class CMainParams : public CChainParams { /** Prog PoW **/ consensus.nPPSwitchHeight = 490000; //placeholder set to disconnect peers. consensus.nPPSwitchTime = 1666350000; // Friday, October 21, 2022 11:00:00 AM GMT - consensus.nInitialPPDifficulty = 0x1d016e81; // ~10 MH/s + consensus.nInitialPPDifficulty = 0x1b1774cd; // 40GH/s consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008