Cleanup, comment out test code, prepare for release PR
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "key_io.h"
|
||||
#include "CCinclude.h"
|
||||
#include "CCassets.h"
|
||||
#include "CCfaucet.h"
|
||||
@@ -56,7 +57,7 @@
|
||||
// to create a new CCaddr, add to rpcwallet the CCaddress and start with -pubkey= with the pubkey of the new address, with its wif already imported. set normaladdr and CChexstr. run CCaddress and it will print the privkey along with autocorrect the CCaddress. which should then update the CCaddr here
|
||||
|
||||
// StakeGuard - nothing at stake
|
||||
std::string StakeGuardaddr = "RCG8KwJNDVwpUBcdoa6AoHqHVJsA1uMYMR";
|
||||
std::string StakeGuardAddr = "RCG8KwJNDVwpUBcdoa6AoHqHVJsA1uMYMR";
|
||||
std::string StakeGuardPubKey = "03166b7813a4855a88e9ef7340a692ef3c2decedfdc2c7563ec79537e89667d935";
|
||||
std::string StakeGuardWIF = "Uw7vRYHGKjyi1FaJ8Lv1USSuj7ntUti8fAhSDiCdbzuV6yDagaTn";
|
||||
|
||||
@@ -233,12 +234,12 @@ struct CCcontract_info *CCinit(struct CCcontract_info *cp, uint8_t evalcode)
|
||||
switch ( evalcode )
|
||||
{
|
||||
case EVAL_STAKEGUARD:
|
||||
strcpy(cp->unspendableCCaddr,AssetsCCaddr);
|
||||
strcpy(cp->normaladdr,AssetsNormaladdr);
|
||||
strcpy(cp->CChexstr,AssetsCChexstr);
|
||||
memcpy(cp->CCpriv,AssetsCCpriv,32);
|
||||
strcpy(cp->unspendableCCaddr,StakeGuardAddr.c_str());
|
||||
strcpy(cp->normaladdr,StakeGuardAddr.c_str());
|
||||
strcpy(cp->CChexstr,StakeGuardPubKey.c_str());
|
||||
memcpy(cp->CCpriv,DecodeSecret(StakeGuardWIF).begin(),32);
|
||||
cp->validate = StakeGuardValidate;
|
||||
cp->ismyvin = IsAssetsInput;
|
||||
cp->ismyvin = IsStakeGuardInput;
|
||||
break;
|
||||
|
||||
case EVAL_ASSETS:
|
||||
|
||||
@@ -431,6 +431,12 @@ bool StakeGuardValidate(struct CCcontract_info *cp, Eval* eval, const CTransacti
|
||||
else return true;
|
||||
}
|
||||
|
||||
bool IsStakeGuardInput(const CScript &scriptSig)
|
||||
{
|
||||
printf("IsStakeGuardInput: not implemented");
|
||||
return false;
|
||||
}
|
||||
|
||||
UniValue StakeGuardInfo()
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); char numstr[64];
|
||||
|
||||
@@ -34,6 +34,8 @@ bool MakeCheatEvidence(CMutableTransaction &mtx, const CTransaction &ccTx, uint3
|
||||
|
||||
bool StakeGuardValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
||||
|
||||
bool IsStakeGuardInput(const CScript &scriptSig);
|
||||
|
||||
UniValue StakeGuardInfo();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -99,7 +99,7 @@ bool CCheatList::Add(const CTxHolder &txh)
|
||||
LOCK(cs_cheat);
|
||||
auto it = orderedCheatCandidates.insert(pair<const uint32_t, CTxHolder>(txh.height, txh));
|
||||
indexedCheatCandidates.insert(pair<const uint256, CTxHolder *>(txh.utxo, &it->second));
|
||||
printf("CCheatList::Add orderedCheatCandidates.size: %d, indexedCheatCandidates.size: %d\n", orderedCheatCandidates.size(), indexedCheatCandidates.size());
|
||||
//printf("CCheatList::Add orderedCheatCandidates.size: %d, indexedCheatCandidates.size: %d\n", (int)orderedCheatCandidates.size(), (int)indexedCheatCandidates.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -687,10 +687,10 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
|
||||
}
|
||||
}
|
||||
}
|
||||
// we don't want any of these checks in VRSC, leave it for other chains until/unless KMD removes
|
||||
// we don't want these checks in VRSC, leave it at the Sapling upgrade
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 ||
|
||||
(ASSETCHAINS_COMMISSION != 0 && height > 1) ||
|
||||
(strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0 && height < VRSC_SAPLING_UPGRADE) )
|
||||
NetworkUpgradeActive(height, Params().GetConsensus(), Consensus::UPGRADE_SAPLING) )
|
||||
{
|
||||
n = block.vtx[0].vout.size();
|
||||
int64_t val,prevtotal = 0; int32_t strangeout=0,overflow = 0;
|
||||
|
||||
@@ -239,6 +239,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
||||
|
||||
// check if we should add cheat transaction
|
||||
CBlockIndex *ppast;
|
||||
CTransaction cb;
|
||||
int cheatHeight = nHeight - COINBASE_MATURITY < 1 ? 1 : nHeight - COINBASE_MATURITY;
|
||||
if (cheatCatcher &&
|
||||
sapling && chainActive.Height() > 100 &&
|
||||
@@ -263,7 +264,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
||||
extern CWallet *pwalletMain;
|
||||
LOCK(pwalletMain->cs_wallet);
|
||||
TransactionBuilder tb = TransactionBuilder(consensusParams, nHeight);
|
||||
CTransaction cb = b.vtx[0];
|
||||
cb = b.vtx[0];
|
||||
cbHash = cb.GetHash();
|
||||
|
||||
bool hasInput = false;
|
||||
@@ -314,7 +315,7 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
||||
std::list<CTransaction> removed;
|
||||
mempool.removeConflicts(cheatSpend.value(), removed);
|
||||
printf("Found cheating stake! Adding cheat spend for %.8f at block #%d, coinbase tx\n%s\n",
|
||||
(double)cheatSpend.value().vout[0].nValue / (double)COIN, nHeight, cheatSpend.value().vin[0].prevout.hash.GetHex().c_str());
|
||||
(double)cb.GetValueOut() / (double)COIN, nHeight, cheatSpend.value().vin[0].prevout.hash.GetHex().c_str());
|
||||
}
|
||||
|
||||
// now add transactions from the mem pool
|
||||
|
||||
@@ -15,8 +15,6 @@ bool CPOSNonce::NewPOSActive(int32_t height)
|
||||
{
|
||||
if ((strcmp(ASSETCHAINS_SYMBOL, "VRSC") == 0) && (height < (96480 + 100)))
|
||||
return false;
|
||||
else if ((strcmp(ASSETCHAINS_SYMBOL, "VRSCTEST") == 0) && (height < (1000 + 100)))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
@@ -25,8 +23,6 @@ bool CPOSNonce::NewNonceActive(int32_t height)
|
||||
{
|
||||
if ((strcmp(ASSETCHAINS_SYMBOL, "VRSC") == 0) && (height < 96480))
|
||||
return false;
|
||||
else if ((strcmp(ASSETCHAINS_SYMBOL, "VRSCTEST") == 0) && (height < 1000))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1420,12 +1420,11 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
|
||||
else
|
||||
return 0;
|
||||
|
||||
// TODO: REMOVE THIS: THIS MAKES A CHEAT TRANSACTION FOR EVERY STAKE FOR TESTING
|
||||
CMutableTransaction cheat;
|
||||
// UP TO HERE
|
||||
// !! DISABLE THIS FOR RELEASE: THIS MAKES A CHEAT TRANSACTION FOR EVERY STAKE FOR TESTING
|
||||
//CMutableTransaction cheat;
|
||||
// !! DOWN TO HERE
|
||||
|
||||
// if we are staking with the extended format, add the opreturn data required
|
||||
//
|
||||
if (extendedStake)
|
||||
{
|
||||
uint256 srcBlock = uint256();
|
||||
@@ -1440,30 +1439,30 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
|
||||
if ((pSrcIndex = mapBlockIndex[srcBlock]) == 0)
|
||||
return 0;
|
||||
|
||||
// TODO: REMOVE THIS: THIS MAKES A CHEAT TRANSACTION FOR EVERY STAKE FOR TESTING
|
||||
cheat = CMutableTransaction(txNew);
|
||||
cheat.vout[1].scriptPubKey << OP_RETURN
|
||||
<< CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, pSrcIndex->GetBlockHash(), pk).AsVector();
|
||||
// REMOVE UP TO HERE
|
||||
// !! DISABLE THIS FOR RELEASE: THIS MAKES A CHEAT TRANSACTION FOR EVERY STAKE FOR TESTING
|
||||
//cheat = CMutableTransaction(txNew);
|
||||
//cheat.vout[1].scriptPubKey << OP_RETURN
|
||||
// << CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, pSrcIndex->GetBlockHash(), pk).AsVector();
|
||||
// !! DOWN TO HERE
|
||||
|
||||
txOut1.scriptPubKey << OP_RETURN
|
||||
<< CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, tipindex->GetBlockHash(), pk).AsVector();
|
||||
}
|
||||
|
||||
// TODO REMOVE THIS TOO
|
||||
nValue = cheat.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;
|
||||
cheat.nLockTime = 0;
|
||||
CTransaction cheatConst(cheat);
|
||||
SignatureData cheatSig;
|
||||
if (!ProduceSignature(TransactionSignatureCreator(&keystore, &cheatConst, 0, nValue, SIGHASH_ALL), stakeSource.vout[voutNum].scriptPubKey, cheatSig, consensusBranchId))
|
||||
fprintf(stderr,"failed to create cheat test signature\n");
|
||||
else
|
||||
{
|
||||
uint8_t *ptr;
|
||||
UpdateTransaction(cheat,0,cheatSig);
|
||||
cheatList.Add(CTxHolder(CTransaction(cheat), tipindex->GetHeight() + 1));
|
||||
}
|
||||
// UP TO HERE
|
||||
// !! DISABLE THIS FOR RELEASE: REMOVE THIS TOO
|
||||
//nValue = cheat.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;
|
||||
//cheat.nLockTime = 0;
|
||||
//CTransaction cheatConst(cheat);
|
||||
//SignatureData cheatSig;
|
||||
//if (!ProduceSignature(TransactionSignatureCreator(&keystore, &cheatConst, 0, nValue, SIGHASH_ALL), stakeSource.vout[voutNum].scriptPubKey, cheatSig, consensusBranchId))
|
||||
// fprintf(stderr,"failed to create cheat test signature\n");
|
||||
//else
|
||||
//{
|
||||
// uint8_t *ptr;
|
||||
// UpdateTransaction(cheat,0,cheatSig);
|
||||
// cheatList.Add(CTxHolder(CTransaction(cheat), tipindex->GetHeight() + 1));
|
||||
//}
|
||||
// !! DOWN TO HERE
|
||||
|
||||
nValue = txNew.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user