Merge pull request #949 from blackjok3rtt/disable_coinbase_option
Disable coinbase option
This commit is contained in:
@@ -290,9 +290,9 @@ int32_t CC_vinselect(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *
|
||||
abovei = belowi = -1;
|
||||
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 )
|
||||
// Filter to randomly pick utxo to avoid conflicts, and having multiple CC choose the same ones.
|
||||
//if ( numunspents > 200 ) {
|
||||
// if ( (rand() % 100) < 90 )
|
||||
// continue;
|
||||
//}
|
||||
if ( (atx_value= utxos[i].nValue) <= 0 )
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
@@ -5620,7 +5623,7 @@ UniValue gatewayswithdraw(const UniValue& params, bool fHelp)
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
coin = params[1].get_str();
|
||||
withdrawpub = ParseHex(params[2].get_str());
|
||||
amount = atof((char *)params[3].get_str().c_str()) * COIN + 0.00000000499999;
|
||||
hex = GatewaysWithdraw(0,bindtxid,coin,pubkey2pk(withdrawpub),amount);
|
||||
@@ -5673,7 +5676,7 @@ UniValue gatewaysmultisig(const UniValue& params, bool fHelp)
|
||||
if ( ensure_CCrequirements() < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txidaddr = (char *)params[0].get_str().c_str();
|
||||
return(GatewaysMultisig(txidaddr));
|
||||
}
|
||||
@@ -5686,7 +5689,7 @@ UniValue gatewayspartialsign(const UniValue& params, bool fHelp)
|
||||
if ( ensure_CCrequirements() < 0 )
|
||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
parthex = params[2].get_str();
|
||||
|
||||
Reference in New Issue
Block a user