]> Git Repo - VerusCoin.git/commitdiff
Equals operator for copying proofs
authormiketout <[email protected]>
Thu, 7 May 2020 04:57:26 +0000 (21:57 -0700)
committermiketout <[email protected]>
Thu, 7 May 2020 04:57:26 +0000 (21:57 -0700)
src/mmr.cpp
src/mmr.h
src/pbaas/pbaas.h
src/rpc/pbaasrpc.cpp

index 324131ab049e30e44e303264ac413d9232ad7891..c396b5d30c4c0e3cfe597f99a24155454a8b2e80 100644 (file)
@@ -12,6 +12,7 @@
 void ErrorAndBP(std::string msg)
 {
     printf("%s\n", msg.c_str());
+    LogPrintf("%s\n", msg.c_str());
 }
 
 
@@ -40,8 +41,9 @@ void CMMRProof::DeleteProofSequence()
             }
             default:
             {
-                ErrorAndBP("ERROR: unrecognized object in proof sequence");
-                delete pProof;
+                ErrorAndBP("ERROR: likely double-free or memory corruption, unrecognized object in proof sequence");
+                // this is likely a memory error
+                // delete pProof;
             }
         }
         proofSequence.pop_back();
index ac04c8bb23d10249b41674b42f8d18e08bedc0ae..960980fa14698e14bdc8768a688860a9f433b1f9 100644 (file)
--- a/src/mmr.h
+++ b/src/mmr.h
@@ -495,6 +495,14 @@ public:
         s << oldProof;
         s >> *this;
     }
+    const CMMRProof &operator=(const CMMRProof &operand)
+    {
+        CDataStream s(SER_NETWORK, PROTOCOL_VERSION);
+        s << operand;
+        DeleteProofSequence();
+        s >> *this;
+        return *this;
+    }
 
     ~CMMRProof()
     {
index 48af27179a2730acf7179c308ed35eb26b44fe5e..44b3339b9c3bd4937b157ca74b3184cfd356ce0e 100644 (file)
@@ -220,6 +220,15 @@ public:
         version = VERSION_INVALID;
     }
 
+    const CCrossChainProof &operator=(const CCrossChainProof &operand)
+    {
+        CDataStream s(SER_NETWORK, PROTOCOL_VERSION);
+        s << operand;
+        DeleteOpRetObjects(chainObjects);
+        s >> *this;
+        return *this;
+    }
+
     ADD_SERIALIZE_METHODS;
 
     template <typename Stream, typename Operation>
index 696985b170fc5c9e84d44c90ef7e469b7f7eff1c..195b9884d9de2a731c4c4be06d99a3f63220e003 100644 (file)
@@ -3619,7 +3619,7 @@ bool RefundFailedLaunch(uint160 currencyID, CTransaction &lastImportTx, std::vec
     CTransaction chainDefTx;
     uint160 thisChainID = ConnectedChains.ThisChain().GetID();
 
-    LOCK(cs_main);
+    LOCK2(cs_main, mempool.cs);
 
     if (!GetCurrencyDefinition(currencyID, chainDef, &defHeight) || currencyID == thisChainID)
     {
@@ -3689,7 +3689,7 @@ bool RefundFailedLaunch(uint160 currencyID, CTransaction &lastImportTx, std::vec
     if (!found)
     {
         LogPrintf("%s: No export thread found\n", __func__);
-        printf("%s: No export thread found\n", __func__);
+        //printf("%s: No export thread found\n", __func__);
         return false;
     }
 
@@ -3911,10 +3911,6 @@ bool RefundFailedLaunch(uint160 currencyID, CTransaction &lastImportTx, std::vec
                     if (aixIt->second.second.vout[i].scriptPubKey.IsPayToCryptoCondition(p) && p.IsValid() && p.evalCode == EVAL_RESERVE_DEPOSIT)
                     {
                         newImportTx.vin.push_back(CTxIn(depositTxId, i, CScript()));
-                        for (auto &oneCur : aixIt->second.second.vout[i].ReserveOutValue().valueMap)
-                        {
-                            rtxd.AddReserveInput(oneCur.first, oneCur.second);
-                        }
                     }
                 }
 
This page took 0.043378 seconds and 4 git commands to generate.