X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fmain.cpp;h=ca9351f5a1eacc40c97178f659bd3cc925d85c14;hp=c830a8ffadafe694ea104edc00180c5473a4b355;hb=d8f8063eda45b8dec864b28bb98839a2dd3a8170;hpb=68fbc35ade50af7e8b0ec0fe80e9a1372bccba2c diff --git a/src/main.cpp b/src/main.cpp index c830a8f..ca9351f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,8 +44,8 @@ uint256 nPoWBase = uint256("0x00000000ffff00000000000000000000000000000000000000 CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 16); -unsigned int nStakeMinAge = 60 * 60 * 24 * 30; // 30 days as minimum age for coin age -unsigned int nStakeMaxAge = 60 * 60 * 24 * 90; // 90 days as stake age of full weight +unsigned int nStakeMinAge = 60 * 60 * 24 * 30; // 30 days as zero time weight +unsigned int nStakeMaxAge = 60 * 60 * 24 * 90; // 90 days as full weight unsigned int nStakeTargetSpacing = 10 * 60; // 10-minute stakes spacing unsigned int nModifierInterval = 6 * 60 * 60; // time to elapse before new modifier is computed @@ -2701,10 +2701,9 @@ bool LoadBlockIndex(bool fAllowNew) // // Load block index // - CTxDB txdb("cr"); + CTxDB txdb("cr+"); if (!txdb.LoadBlockIndex()) return false; - txdb.Close(); // // Init with genesis block @@ -2767,25 +2766,19 @@ bool LoadBlockIndex(bool fAllowNew) return error("LoadBlockIndex() : failed to init sync checkpoint"); } - // ppcoin: if checkpoint master key changed must reset sync-checkpoint - { - CTxDB txdb; - string strPubKey = ""; - if (!txdb.ReadCheckpointPubKey(strPubKey) || strPubKey != CSyncCheckpoint::strMasterPubKey) - { - // write checkpoint master key to db - txdb.TxnBegin(); - if (!txdb.WriteCheckpointPubKey(CSyncCheckpoint::strMasterPubKey)) - return error("LoadBlockIndex() : failed to write new checkpoint master key to db"); - if (!txdb.TxnCommit()) - return error("LoadBlockIndex() : failed to commit new checkpoint master key to db"); - if ((!fTestNet) && !Checkpoints::ResetSyncCheckpoint()) - return error("LoadBlockIndex() : failed to reset sync-checkpoint"); - } -#ifndef USE_LEVELDB - txdb.Close(); -#endif + string strPubKey = ""; + // if checkpoint master key changed must reset sync-checkpoint + if (!txdb.ReadCheckpointPubKey(strPubKey) || strPubKey != CSyncCheckpoint::strMasterPubKey) + { + // write checkpoint master key to db + txdb.TxnBegin(); + if (!txdb.WriteCheckpointPubKey(CSyncCheckpoint::strMasterPubKey)) + return error("LoadBlockIndex() : failed to write new checkpoint master key to db"); + if (!txdb.TxnCommit()) + return error("LoadBlockIndex() : failed to commit new checkpoint master key to db"); + if ((!fTestNet) && !Checkpoints::ResetSyncCheckpoint()) + return error("LoadBlockIndex() : failed to reset sync-checkpoint"); } return true;