Browse Source

src/rpc/mining.cpp upstream changes

pull/51/head
Duke Leto 5 years ago
parent
commit
0202e3436d
  1. 37
      src/rpc/mining.cpp

37
src/rpc/mining.cpp

@ -99,7 +99,7 @@ int64_t GetNetworkHashPS(int lookup, int height)
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)
throw runtime_error(
@ -117,7 +117,7 @@ UniValue getlocalsolps(const UniValue& params, bool fHelp)
return GetLocalSolPS();
}
UniValue getnetworksolps(const UniValue& params, bool fHelp)
UniValue getnetworksolps(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() > 2)
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);
}
UniValue getnetworkhashps(const UniValue& params, bool fHelp)
UniValue getnetworkhashps(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() > 2)
throw runtime_error(
@ -163,7 +163,8 @@ UniValue getnetworkhashps(const UniValue& params, bool fHelp)
}
#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)
throw runtime_error(
@ -196,7 +197,7 @@ UniValue getgenerate(const UniValue& params, bool fHelp)
extern uint8_t NOTARY_PUBKEY33[33];
//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)
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)
throw runtime_error(
@ -390,7 +391,7 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
CBlockIndex *komodo_chainactive(int32_t height);
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);
if (fHelp || params.size() != 0 )
@ -433,7 +434,7 @@ UniValue genminingCSV(const UniValue& params, bool fHelp)
return(result);
}
UniValue getmininginfo(const UniValue& params, bool fHelp)
UniValue getmininginfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@ -471,14 +472,14 @@ UniValue getmininginfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("genproclimit", (int)GetArg("-genproclimit", -1)));
if (ASSETCHAINS_ALGO == ASSETCHAINS_EQUIHASH)
{
obj.push_back(Pair("localsolps" , getlocalsolps(params, false)));
obj.push_back(Pair("networksolps", getnetworksolps(params, false)));
obj.push_back(Pair("localsolps" , getlocalsolps(params, false, mypk)));
obj.push_back(Pair("networksolps", getnetworksolps(params, false, mypk)));
}
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("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
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
UniValue prioritisetransaction(const UniValue& params, bool fHelp)
UniValue prioritisetransaction(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() != 3)
throw runtime_error(
@ -543,7 +544,7 @@ static UniValue BIP22ValidationResult(const CValidationState& state)
return "valid?";
}
UniValue getblocktemplate(const UniValue& params, bool fHelp)
UniValue getblocktemplate(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() > 1)
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)
throw runtime_error(
@ -973,7 +974,7 @@ UniValue submitblock(const UniValue& params, bool fHelp)
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)
throw runtime_error(
@ -1005,7 +1006,7 @@ UniValue estimatefee(const UniValue& params, bool fHelp)
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)
throw runtime_error(
@ -1033,7 +1034,7 @@ UniValue estimatepriority(const UniValue& params, bool fHelp)
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)
throw runtime_error(

Loading…
Cancel
Save