Cleanup
authoralexhz <balthazar@yandex.ru>
Sat, 6 Apr 2013 13:05:12 +0000 (13:05 +0000)
committeralexhz <balthazar@yandex.ru>
Sat, 6 Apr 2013 13:05:12 +0000 (13:05 +0000)
src/main.cpp
src/main.h

index 1befcb8..a14bf46 100644 (file)
@@ -892,19 +892,10 @@ static const int64 nTargetSpacingWorkMax = 12 * STAKE_TARGET_SPACING; // 2-hour
 // minimum amount of work that could possibly be required nTime after
 // minimum work required was nBase
 //
-unsigned int ComputeMinWork(unsigned int nBase, int64 nTime, bool fProofOfStake, int nHeight)
+unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)
 {
     CBigNum bnTargetLimit = bnProofOfWorkLimit;
 
-    if(fProofOfStake)
-    {
-        // Proof-of-Stake blocks has own target limit since nVersion=3 supermajority on mainNet and always on testNet
-        if(fTestNet || nHeight > 15000)
-            bnTargetLimit = bnProofOfStakeLimit;
-        else if(nHeight > 14060)
-            bnTargetLimit = bnProofOfStakeHardLimit;
-    }
-
     CBigNum bnResult;
     bnResult.SetCompact(nBase);
     bnResult *= 2;
@@ -1945,25 +1936,6 @@ bool CBlock::CheckBlock() const
     return true;
 }
 
-int CBlock::GetBlockHeight() const
-{
-    if(nVersion == 1)
-        return 0;
-
-    if(vtx[0].vin[0].scriptSig[0] > 4)
-        return vtx[0].vin[0].scriptSig[0] - 80;
-
-    int nBlockHeight = 0;
-
-    memcpy((void *)&nBlockHeight, (const void *)&vtx[0].vin[0].scriptSig[1], vtx[0].vin[0].scriptSig[0]);
-
-#ifdef BIGENDIAN
-    return htonl(nBlockHeight);
-#else
-    return nBlockHeight;
-#endif
-}
-
 bool CBlock::AcceptBlock()
 {
     // Check for duplicate
@@ -2007,14 +1979,6 @@ bool CBlock::AcceptBlock()
     if (!std::equal(expect.begin(), expect.end(), vtx[0].vin[0].scriptSig.begin()))
         return DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
 
-    /**
-      * TODO: replace previous check with this.
-      */
-
-    // if(nHeight != GetBlockHeight())
-    //    return DoS(100, error("AcceptBlock() : block height mismatch in coinbase"));
-
-
     // Write block to history file
     if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK, CLIENT_VERSION)))
         return error("AcceptBlock() : out of disk space");
@@ -2081,7 +2045,7 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
         CBigNum bnNewBlock;
         bnNewBlock.SetCompact(pblock->nBits);
         CBigNum bnRequired;
-        bnRequired.SetCompact(ComputeMinWork(GetLastBlockIndex(pcheckpoint, pblock->IsProofOfStake())->nBits, deltaTime, pblock->IsProofOfStake(), pblock->GetBlockHeight()));
+        bnRequired.SetCompact(ComputeMinWork(GetLastBlockIndex(pcheckpoint, pblock->IsProofOfStake())->nBits, deltaTime));
 
         if (bnNewBlock > bnRequired)
         {
index 4064a1d..17de9ed 100644 (file)
@@ -117,7 +117,7 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey);
 bool CheckProofOfWork(uint256 hash, unsigned int nBits);
 int64 GetProofOfWorkReward(unsigned int nBits);
 int64 GetProofOfStakeReward(int64 nCoinAge);
-unsigned int ComputeMinWork(unsigned int nBase, int64 nTime, bool fProofOfStake, int nHeight);
+unsigned int ComputeMinWork(unsigned int nBase, int64 nTime);
 int GetNumBlocksOfPeers();
 bool IsInitialBlockDownload();
 std::string GetWarnings(std::string strFor);
@@ -957,8 +957,6 @@ public:
         return thash;
     }
 
-    int GetBlockHeight() const;
-
     int64 GetBlockTime() const
     {
         return (int64)nTime;