From: alex Date: Mon, 2 Sep 2013 19:14:16 +0000 (+0400) Subject: Don't close leveldb in checkpoints handling functions X-Git-Tag: v0.4.4.5~24 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=11ffe1ccae2e10f753e65da227355615f5f9d6f7 Don't close leveldb in checkpoints handling functions --- diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 1ffe1cb..2439d04 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -161,7 +161,10 @@ namespace Checkpoints } if (!txdb.TxnCommit()) return error("WriteSyncCheckpoint(): failed to commit to db sync checkpoint %s", hashCheckpoint.ToString().c_str()); + +#ifndef USE_LEVELDB txdb.Close(); +#endif Checkpoints::hashSyncCheckpoint = hashCheckpoint; return true; @@ -192,8 +195,10 @@ namespace Checkpoints return error("AcceptPendingSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashPendingCheckpoint.ToString().c_str()); } } - txdb.Close(); +#ifndef USE_LEVELDB + txdb.Close(); +#endif if (!WriteSyncCheckpoint(hashPendingCheckpoint)) return error("AcceptPendingSyncCheckpoint(): failed to write sync checkpoint %s", hashPendingCheckpoint.ToString().c_str()); hashPendingCheckpoint = 0; @@ -283,7 +288,11 @@ namespace Checkpoints { return error("ResetSyncCheckpoint: SetBestChain failed for hardened checkpoint %s", hash.ToString().c_str()); } + +#ifndef USE_LEVELDB txdb.Close(); +#endif + } else if(!mapBlockIndex.count(hash)) { @@ -449,7 +458,10 @@ bool CSyncCheckpoint::ProcessSyncCheckpoint(CNode* pfrom) return error("ProcessSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashCheckpoint.ToString().c_str()); } } + +#ifndef USE_LEVELDB txdb.Close(); +#endif if (!Checkpoints::WriteSyncCheckpoint(hashCheckpoint)) return error("ProcessSyncCheckpoint(): failed to write sync checkpoint %s", hashCheckpoint.ToString().c_str()); diff --git a/src/main.cpp b/src/main.cpp index 4f6d71f..eb2dbc6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2792,7 +2792,10 @@ bool LoadBlockIndex(bool fAllowNew) if ((!fTestNet) && !Checkpoints::ResetSyncCheckpoint()) return error("LoadBlockIndex() : failed to reset sync-checkpoint"); } +#ifndef USE_LEVELDB txdb.Close(); +#endif + } return true;