* *
******************************************************************************/
+#include "key_io.h"
#include "CCinclude.h"
#include "CCassets.h"
#include "CCfaucet.h"
// 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";
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:
else return true;
}
+bool IsStakeGuardInput(const CScript &scriptSig)
+{
+ printf("IsStakeGuardInput: not implemented");
+ return false;
+}
+
UniValue StakeGuardInfo()
{
UniValue result(UniValue::VOBJ); char numstr[64];
bool StakeGuardValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
+bool IsStakeGuardInput(const CScript &scriptSig);
+
UniValue StakeGuardInfo();
#endif
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());
}
}
}
}
}
- // 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;
// 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 &&
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;
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
{
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;
}
{
if ((strcmp(ASSETCHAINS_SYMBOL, "VRSC") == 0) && (height < 96480))
return false;
- else if ((strcmp(ASSETCHAINS_SYMBOL, "VRSCTEST") == 0) && (height < 1000))
- return false;
else
return true;
}
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();
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;