Merge pull request #949 from blackjok3rtt/disable_coinbase_option

Disable coinbase option
This commit is contained in:
jl777
2018-11-14 08:49:03 -11:00
committed by GitHub
3 changed files with 24 additions and 20 deletions

View File

@@ -291,8 +291,8 @@ int32_t CC_vinselect(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *
for (above=below=i=0; i<numunspents; i++)
{
// Filter to randomly pick utxo to avoid conflicts, and having multiple CC choose the same ones.
//if ( numunspents > 500 ) {
// if ( (rand() % 100) < 80 )
//if ( numunspents > 200 ) {
// if ( (rand() % 100) < 90 )
// continue;
//}
if ( (atx_value= utxos[i].nValue) <= 0 )

View File

@@ -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:

View File

@@ -4924,7 +4924,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
if ( fHelp || params.size() != 1 )
throw runtime_error(
"setpubkey\n"
"\nSets the -pubkey if the daemon was not started with it, if it was already set, it returns the pubkey.\n"
"\nSets the -pubkey if the daemon was not started with it, if it was already set, it returns the pubkey, and its Raddress.\n"
"\nArguments:\n"
"1. \"pubkey\" (string) pubkey to set.\n"
"\nResult:\n"
@@ -4974,7 +4974,10 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string."));
}
} else {
result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon."));
result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon, pubkey in use is below."));
pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33);
std::string address_ret; address_ret.assign(Raddress);
result.push_back(Pair("address",address_ret));
}
result.push_back(Pair("pubkey", NOTARY_PUBKEY));
return result;