src/rpc/mining.cpp upstream changes
This commit is contained in:
@@ -99,7 +99,7 @@ int64_t GetNetworkHashPS(int lookup, int height)
|
|||||||
return (int64_t)(workDiff.getdouble() / timeDiff);
|
return (int64_t)(workDiff.getdouble() / timeDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getlocalsolps(const UniValue& params, bool fHelp)
|
UniValue getlocalsolps(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp)
|
if (fHelp)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -117,7 +117,7 @@ UniValue getlocalsolps(const UniValue& params, bool fHelp)
|
|||||||
return GetLocalSolPS();
|
return GetLocalSolPS();
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getnetworksolps(const UniValue& params, bool fHelp)
|
UniValue getnetworksolps(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() > 2)
|
if (fHelp || params.size() > 2)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -139,7 +139,7 @@ UniValue getnetworksolps(const UniValue& params, bool fHelp)
|
|||||||
return GetNetworkHashPS(params.size() > 0 ? params[0].get_int() : 120, params.size() > 1 ? params[1].get_int() : -1);
|
return GetNetworkHashPS(params.size() > 0 ? params[0].get_int() : 120, params.size() > 1 ? params[1].get_int() : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getnetworkhashps(const UniValue& params, bool fHelp)
|
UniValue getnetworkhashps(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() > 2)
|
if (fHelp || params.size() > 2)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -163,7 +163,8 @@ UniValue getnetworkhashps(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MINING
|
#ifdef ENABLE_MINING
|
||||||
UniValue getgenerate(const UniValue& params, bool fHelp)
|
extern bool VERUS_MINTBLOCKS;
|
||||||
|
UniValue getgenerate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() != 0)
|
if (fHelp || params.size() != 0)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -196,7 +197,7 @@ UniValue getgenerate(const UniValue& params, bool fHelp)
|
|||||||
extern uint8_t NOTARY_PUBKEY33[33];
|
extern uint8_t NOTARY_PUBKEY33[33];
|
||||||
|
|
||||||
//Value generate(const Array& params, bool fHelp)
|
//Value generate(const Array& params, bool fHelp)
|
||||||
UniValue generate(const UniValue& params, bool fHelp)
|
UniValue generate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() < 1 || params.size() > 1)
|
if (fHelp || params.size() < 1 || params.size() > 1)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -323,7 +324,7 @@ endloop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UniValue setgenerate(const UniValue& params, bool fHelp)
|
UniValue setgenerate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -390,7 +391,7 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
|
|||||||
CBlockIndex *komodo_chainactive(int32_t height);
|
CBlockIndex *komodo_chainactive(int32_t height);
|
||||||
arith_uint256 zawy_ctB(arith_uint256 bnTarget,uint32_t solvetime);
|
arith_uint256 zawy_ctB(arith_uint256 bnTarget,uint32_t solvetime);
|
||||||
|
|
||||||
UniValue genminingCSV(const UniValue& params, bool fHelp)
|
UniValue genminingCSV(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
int32_t i,z,height; uint32_t solvetime,prevtime=0; FILE *fp; char str[65],str2[65],fname[256]; uint256 hash; arith_uint256 bnTarget; CBlockIndex *pindex; bool fNegative,fOverflow; UniValue result(UniValue::VOBJ);
|
int32_t i,z,height; uint32_t solvetime,prevtime=0; FILE *fp; char str[65],str2[65],fname[256]; uint256 hash; arith_uint256 bnTarget; CBlockIndex *pindex; bool fNegative,fOverflow; UniValue result(UniValue::VOBJ);
|
||||||
if (fHelp || params.size() != 0 )
|
if (fHelp || params.size() != 0 )
|
||||||
@@ -433,7 +434,7 @@ UniValue genminingCSV(const UniValue& params, bool fHelp)
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getmininginfo(const UniValue& params, bool fHelp)
|
UniValue getmininginfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() != 0)
|
if (fHelp || params.size() != 0)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -471,14 +472,14 @@ UniValue getmininginfo(const UniValue& params, bool fHelp)
|
|||||||
obj.push_back(Pair("genproclimit", (int)GetArg("-genproclimit", -1)));
|
obj.push_back(Pair("genproclimit", (int)GetArg("-genproclimit", -1)));
|
||||||
if (ASSETCHAINS_ALGO == ASSETCHAINS_EQUIHASH)
|
if (ASSETCHAINS_ALGO == ASSETCHAINS_EQUIHASH)
|
||||||
{
|
{
|
||||||
obj.push_back(Pair("localsolps" , getlocalsolps(params, false)));
|
obj.push_back(Pair("localsolps" , getlocalsolps(params, false, mypk)));
|
||||||
obj.push_back(Pair("networksolps", getnetworksolps(params, false)));
|
obj.push_back(Pair("networksolps", getnetworksolps(params, false, mypk)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
obj.push_back(Pair("localhashps" , GetBoolArg("-gen", false) ? getlocalsolps(params, false) : (double)0.0));
|
obj.push_back(Pair("localhashps" , GetBoolArg("-gen", false) ? getlocalsolps(params, false, mypk) : (double)0.0));
|
||||||
}
|
}
|
||||||
obj.push_back(Pair("networkhashps", getnetworksolps(params, false)));
|
obj.push_back(Pair("networkhashps", getnetworksolps(params, false, mypk)));
|
||||||
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
|
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
|
||||||
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
|
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
|
||||||
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
||||||
@@ -493,7 +494,7 @@ UniValue getmininginfo(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
|
|
||||||
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
|
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
|
||||||
UniValue prioritisetransaction(const UniValue& params, bool fHelp)
|
UniValue prioritisetransaction(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() != 3)
|
if (fHelp || params.size() != 3)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -543,7 +544,7 @@ static UniValue BIP22ValidationResult(const CValidationState& state)
|
|||||||
return "valid?";
|
return "valid?";
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
UniValue getblocktemplate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() > 1)
|
if (fHelp || params.size() > 1)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -901,7 +902,7 @@ protected:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
UniValue submitblock(const UniValue& params, bool fHelp)
|
UniValue submitblock(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -973,7 +974,7 @@ UniValue submitblock(const UniValue& params, bool fHelp)
|
|||||||
return BIP22ValidationResult(state);
|
return BIP22ValidationResult(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue estimatefee(const UniValue& params, bool fHelp)
|
UniValue estimatefee(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() != 1)
|
if (fHelp || params.size() != 1)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -1005,7 +1006,7 @@ UniValue estimatefee(const UniValue& params, bool fHelp)
|
|||||||
return ValueFromAmount(feeRate.GetFeePerK());
|
return ValueFromAmount(feeRate.GetFeePerK());
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue estimatepriority(const UniValue& params, bool fHelp)
|
UniValue estimatepriority(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() != 1)
|
if (fHelp || params.size() != 1)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
@@ -1033,7 +1034,7 @@ UniValue estimatepriority(const UniValue& params, bool fHelp)
|
|||||||
return mempool.estimatePriority(nBlocks);
|
return mempool.estimatePriority(nBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getblocksubsidy(const UniValue& params, bool fHelp)
|
UniValue getblocksubsidy(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() > 1)
|
if (fHelp || params.size() > 1)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
|
|||||||
Reference in New Issue
Block a user