]> Git Repo - VerusCoin.git/commitdiff
Cleanup, comment out test code, prepare for release PR
authormiketout <[email protected]>
Sun, 14 Oct 2018 05:49:45 +0000 (22:49 -0700)
committermiketout <[email protected]>
Sun, 14 Oct 2018 05:49:45 +0000 (22:49 -0700)
src/cc/CCcustom.cpp
src/cc/StakeGuard.cpp
src/cc/StakeGuard.h
src/cheatcatcher.cpp
src/komodo_gateway.h
src/miner.cpp
src/primitives/nonce.cpp
src/wallet/wallet.cpp

index e60f66acff6748d1baae08fe7696e746e4411f00..ae9188eeac29a76f551525a535c17dac28c3a5a5 100644 (file)
@@ -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:
index 6d4ec999cd72114fde1cd0bf29b1fbfe11aceff4..04669aa4df952529bd332c98f114a19dc79c5061 100644 (file)
@@ -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];
index 0149c618b8146ee8a8d0ae3831721162680fb615..824d09efbfbbf8c638bc7914db8d404f613f5626 100644 (file)
@@ -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
index c48f80f1e77a3da1b3b3ddcf6b705315e830c18b..8cdfa9718508a2e9672202cafa6e2e8c49b23807 100644 (file)
@@ -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());
     }
 }
 
index 16e165534a24d875632ec17f53a0d26efaf0a81b..7e85d80fa7cd4cef5036d50f1de4fbb65552371b 100644 (file)
@@ -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;
index 674d6540fc4c026be1d47cc7b5d07d40c943e716..5fdaf9c0ae908d6f793284bdeb23c7c05dd77634 100644 (file)
@@ -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
index 6ff258174376798a703f8a2313e3ad0b574e04fc..85cb7155a57e2671b60da0a09fb86b125dd5f8f9 100644 (file)
@@ -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;
 }
index e343648f6f4f9a5d3a3d458f2afd6b4142be13d4..6f38ba4d4c015fea3822a7aa944233d60fb913b5 100644 (file)
@@ -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;
 
This page took 0.041482 seconds and 4 git commands to generate.