Updating code
reviving this project
This commit is contained in:
+10
-9
@@ -2,6 +2,7 @@
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Copyright (c) 2014-2015 The Dash developers
|
||||
// Copyright (c) 2015-2019 The PIVX developers
|
||||
// Copyright (c) 2026 Agrarian Developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -22,7 +23,7 @@
|
||||
#include "wallet/wallet.h"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/assign/list_of.hpp>
|
||||
|
||||
@@ -37,12 +38,12 @@ using namespace std;
|
||||
*/
|
||||
UniValue GetNetworkHashPS(int lookup, int height)
|
||||
{
|
||||
CBlockIndex *pb = chainActive.Tip();
|
||||
CBlockIndex*pb = chainActive.Tip();
|
||||
|
||||
if (height >= 0 && height < chainActive.Height())
|
||||
pb = chainActive[height];
|
||||
|
||||
if (pb == NULL || !pb->nHeight)
|
||||
if (pb == nullptr || !pb->nHeight)
|
||||
return 0;
|
||||
|
||||
// If lookup is -1, then use blocks since last difficulty change.
|
||||
@@ -158,7 +159,7 @@ UniValue generate(const UniValue& params, bool fHelp)
|
||||
unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey, pwalletMain, fPoS));
|
||||
if (!pblocktemplate.get())
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
|
||||
CBlock *pblock = &pblocktemplate->block;
|
||||
CBlock*pblock = &pblocktemplate->block;
|
||||
|
||||
if(!fPoS){
|
||||
{
|
||||
@@ -172,7 +173,7 @@ UniValue generate(const UniValue& params, bool fHelp)
|
||||
++pblock->nNonce;
|
||||
}
|
||||
CValidationState state;
|
||||
if (!ProcessNewBlock(state, NULL, pblock))
|
||||
if (!ProcessNewBlock(state, nullptr, pblock))
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
|
||||
++nHeight;
|
||||
fPoS = nHeight >= Params().LAST_POW_BLOCK();
|
||||
@@ -201,7 +202,7 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
|
||||
"\nTurn off generation\n" + HelpExampleCli("setgenerate", "false") +
|
||||
"\nUsing json rpc\n" + HelpExampleRpc("setgenerate", "true, 1"));
|
||||
|
||||
if (pwalletMain == NULL)
|
||||
if (pwalletMain == nullptr)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)");
|
||||
|
||||
if (Params().MineBlocksOnDemand())
|
||||
@@ -515,7 +516,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||
if (pindexPrev != chainActive.Tip() ||
|
||||
(mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 5)) {
|
||||
// Clear pindexPrev so future calls make a new block, despite any failures from here on
|
||||
pindexPrev = NULL;
|
||||
pindexPrev = nullptr;
|
||||
|
||||
// Store the chainActive.Tip() used before CreateNewBlock, to avoid races
|
||||
nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
|
||||
@@ -525,7 +526,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
||||
// Create new block
|
||||
if (pblocktemplate) {
|
||||
delete pblocktemplate;
|
||||
pblocktemplate = NULL;
|
||||
pblocktemplate = nullptr;
|
||||
}
|
||||
CScript scriptDummy = CScript() << OP_TRUE;
|
||||
pblocktemplate = CreateNewBlock(scriptDummy, pwalletMain, false);
|
||||
@@ -691,7 +692,7 @@ UniValue submitblock(const UniValue& params, bool fHelp)
|
||||
CValidationState state;
|
||||
submitblock_StateCatcher sc(block.GetHash());
|
||||
RegisterValidationInterface(&sc);
|
||||
bool fAccepted = ProcessNewBlock(state, NULL, &block);
|
||||
bool fAccepted = ProcessNewBlock(state, nullptr, &block);
|
||||
UnregisterValidationInterface(&sc);
|
||||
if (fBlockPresent) {
|
||||
if (fAccepted && !sc.found)
|
||||
|
||||
Reference in New Issue
Block a user