Browse Source

getblock template with mode:disablecb this allows a pool to use the

daemons coinbase tx rather than build its own.
pull/4/head
blackjok3r 6 years ago
parent
commit
29d67993c8
  1. 25
      src/rpcmining.cpp

25
src/rpcmining.cpp

@ -518,10 +518,10 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
#endif
}
std::string strMode = "template";
UniValue lpval = NullUniValue;
// TODO: Re-enable coinbasevalue once a specification has been written
bool coinbasetxn = true;
std::string strMode;
if (params.size() > 0)
{
const UniValue& oparam = params[0].get_obj();
@ -530,12 +530,15 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
strMode = modeval.get_str();
else if (modeval.isNull())
{
/* Do nothing */
strMode = "template";
}
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
lpval = find_value(oparam, "longpollid");
if (strMode == "disablecb")
coinbasetxn = false;
if (strMode == "proposal")
{
const UniValue& dataval = find_value(oparam, "data");
@ -567,9 +570,6 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
}
}
if (strMode != "template")
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode");
if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Komodo is not connected!");
@ -673,8 +673,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
uint256 txHash = tx.GetHash();
setTxIndex[txHash] = i++;
if (tx.IsCoinBase() && !coinbasetxn)
continue;
//if (tx.IsCoinBase() && !coinbasetxn)
// continue;
UniValue entry(UniValue::VOBJ);
@ -694,7 +694,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template]));
entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template]));
if (tx.IsCoinBase()) {
if (tx.IsCoinBase() && coinbasetxn == true ) {
// Show founders' reward if it is required
//if (pblock->vtx[0].vout.size() > 1) {
// Correct this if GetBlockTemplate changes the order
@ -729,10 +729,10 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
if (coinbasetxn) {
assert(txCoinbase.isObject());
result.push_back(Pair("coinbasetxn", txCoinbase));
} else {
result.push_back(Pair("coinbaseaux", aux));
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
}
} // else {
// result.push_back(Pair("coinbaseaux", aux));
// result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
//}
result.push_back(Pair("longpollid", chainActive.LastTip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast)));
if ( ASSETCHAINS_STAKED != 0 )
{
@ -756,6 +756,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
return result;
}
class submitblock_StateCatcher : public CValidationInterface
{
public:

Loading…
Cancel
Save