]> Git Repo - VerusCoin.git/commitdiff
data parsing issues
authormiketout <[email protected]>
Sat, 6 Oct 2018 17:05:48 +0000 (10:05 -0700)
committermiketout <[email protected]>
Sat, 6 Oct 2018 17:05:48 +0000 (10:05 -0700)
src/komodo_bitcoind.h
src/script/script_ext.cpp
src/script/standard.cpp

index fffc57ffa8d377e65801c752ccf9eb0a44ced3ba..587eac221dc723ab298e2bbab8a61a0144b6eee0 100644 (file)
@@ -1457,6 +1457,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
 
 bool GetStakeParams(const CTransaction &stakeTx, CStakeParams &stakeParams);
 bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTransaction &stakeTx, bool &cheating);
+bool ValidateStakeTransaction(const CTransaction &stakeTx, CStakeParams &stakeParams, bool validateSig = true);
 
 // for now, we will ignore slowFlag in the interest of keeping success/fail simpler for security purposes
 bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
@@ -1632,12 +1633,14 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
                                     strcpy(cbaddr, CBitcoinAddress(cbaddress).ToString().c_str());
                                     if (newPOSEnforcement)
                                     {
-                                        if (!strcmp(destaddr,voutaddr))
+                                        if (!strcmp(destaddr, voutaddr))
                                         {
                                             // allow delegation of stake, but require all ouputs to be
                                             // crypto conditions
                                             CStakeParams p;
-                                            if (GetStakeParams(pblock->vtx[txn_count-1], p))
+                                            // validatestake transaction sets the pubkey of the stake output
+                                            // if it has no override into the pubkey
+                                            if (ValidateStakeTransaction(pblock->vtx[txn_count-1], p, false))
                                             {
                                                 COptCCParams cpp;
                                                 // loop through all outputs to make sure they are sent to the proper pubkey
index e4ae41dbebdfeaf3a763dae65cdf0ab5a9db9e39..613b50c0594fa3ba206f33367e984f76589a0031 100644 (file)
@@ -96,8 +96,7 @@ bool CScriptExt::ExtractVoutDestination(const CTransaction& tx, int32_t voutNum,
     // if this is a timelocked transaction, get the destination behind the time lock
     if (tx.IsCoinBase() && tx.vout.size() == 2 && voutNum == 0 &&
         spk.IsPayToScriptHash(&scriptHash) &&
-        tx.vout[1].scriptPubKey.size() >= 7 && // minimum for any possible future to prevent out of bounds
-        tx.vout[1].scriptPubKey[0] == OP_RETURN)
+        tx.vout[1].scriptPubKey.IsOpReturn())
     {
         opcodetype op;
         std::vector<uint8_t> opretData = std::vector<uint8_t>();
index 71fa0d629e48024e6df34f8b86a1f829f2ed9e75..67aa0f28f707bdabcaeeb60dcb714b2d428c0ab0 100644 (file)
@@ -191,16 +191,11 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
                 if (vParams.size())
                 {
                     COptCCParams cp = COptCCParams(vParams[0]);
-                    if (cp.IsValid() && vParams.size() > cp.n)
+                    if (cp.IsValid())
                     {
-                        // all addresses that should be there must be 33 byte pub keys
-                        for (int i = 1; i <= cp.n; i++)
+                        for (auto k : cp.vKeys)
                         {
-                            if (vParams[i].size() != 33)
-                            {
-                                // we accept no errors
-                                return false;
-                            }
+                            vSolutionsRet.push_back(std::vector<unsigned char>(k.begin(), k.end()));
                         }
                     }
                 }
This page took 0.033756 seconds and 4 git commands to generate.