fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
[novacoin.git] / src / main.cpp
index 5c1b138..059dd3d 100644 (file)
@@ -1028,7 +1028,15 @@ bool CTransaction::ConnectInputs(MapPrevTx inputs,
 
             // Verify signature
             if (!VerifySignature(txPrev, *this, i, fStrictPayToScriptHash, 0))
+            {
+                // only during transition phase for P2SH: do not invoke (external)
+                // anti-DoS code for potentially old clients relaying bad P2SH
+                // transactions
+                if (fStrictPayToScriptHash && VerifySignature(txPrev, *this, i, false, 0))
+                    return error("ConnectInputs() : %s P2SH VerifySignature failed", GetHash().ToString().substr(0,10).c_str());
+
                 return error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str());
+            }
 
             // Mark outpoints as spent
             txindex.vSpent[prevout.n] = posThisTx;
@@ -1141,14 +1149,18 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex)
     // This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC.
     // On testnet it is enabled as of februari 20, 2012, 0:00 UTC.
     if (pindex->nTime > 1331769600 || (fTestNet && pindex->nTime > 1329696000))
+    {
         BOOST_FOREACH(CTransaction& tx, vtx)
         {
             CTxIndex txindexOld;
             if (txdb.ReadTxIndex(tx.GetHash(), txindexOld))
+            {
                 BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent)
                     if (pos.IsNull())
                         return false;
+            }
         }
+    }
 
     // P2SH didn't become active until Apr 1 2012 (Feb 15 on testnet)
     int64 nEvalSwitchTime = fTestNet ? 1329264000 : 1333238400;