Skip to content

Commit 06b28fc

Browse files
authored
txdb-leveldb.h fix for Deda
1 parent 72f1a9c commit 06b28fc

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/txdb-leveldb.h

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright (c) 2009-2024 The Bitcoin Developers
2-
// Copyright (c) 2009-2024 The Litedoge Developers
1+
// Copyright (c) 2009-2024 The Bitcoin Developers.
2+
// Copyright (c) 2009-2024 The Litedoge Developers.
33
// Authored by Google, Inc.
44
// Distributed under the MIT/X11 software license, see the accompanying
55
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -8,11 +8,9 @@
88
#define BITCOIN_LEVELDB_H
99

1010
#include "main.h"
11-
#include "db.h"
1211
#include "bignum.h"
1312
#include <leveldb/include/leveldb/write_batch.h>
1413
#include <leveldb/include/leveldb/db.h>
15-
#include "key.h"
1614
#include "script.h"
1715
#include "base58.h"
1816

@@ -69,7 +67,7 @@ class CTxDB
6967
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
7068
ssKey.reserve(1000);
7169
ssKey << key;
72-
string strValue;
70+
std::string strValue;
7371

7472
bool readFromDb = true;
7573
if (activeBatch) {
@@ -88,7 +86,7 @@ class CTxDB
8886
if (status.IsNotFound())
8987
return false;
9088
// Some unexpected error.
91-
printf("LevelDB read failure: %s\n", status.ToString().c_str());
89+
LogPrintf("LevelDB read failure: %s\n", status.ToString());
9290
return false;
9391
}
9492
}
@@ -98,7 +96,7 @@ class CTxDB
9896
SER_DISK, CLIENT_VERSION);
9997
ssValue >> value;
10098
}
101-
catch (const exception&) {
99+
catch (std::exception &e) {
102100
return false;
103101
}
104102
return true;
@@ -116,14 +114,14 @@ class CTxDB
116114
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
117115
ssValue.reserve(10000);
118116
ssValue << value;
119-
117+
120118
if (activeBatch) {
121119
activeBatch->Put(ssKey.str(), ssValue.str());
122120
return true;
123121
}
124-
leveldb::Status status = pdb->Delete(leveldb::WriteOptions(), ssKey.str(), ssValue.str());
122+
leveldb::Status status = pdb->Put(leveldb::WriteOptions(), ssKey.str(), ssValue.str());
125123
if (!status.ok()) {
126-
printf("LevelDB write failure: %s\n", status.ToString().c_str());
124+
LogPrintf("LevelDB write failure: %s\n", status.ToString());
127125
return false;
128126
}
129127
return true;
@@ -182,12 +180,12 @@ class CTxDB
182180
bool ReadVersion(int& nVersion)
183181
{
184182
nVersion = 0;
185-
return Read(string("version"), nVersion);
183+
return Read(std::string("version"), nVersion);
186184
}
187185

188186
bool WriteVersion(int nVersion)
189187
{
190-
return Write(string("version"), nVersion);
188+
return Write(std::string("version"), nVersion);
191189
}
192190

193191
bool ReadTxIndex(uint256 hash, CTxIndex& txindex);
@@ -208,8 +206,6 @@ class CTxDB
208206
bool WriteSyncCheckpoint(uint256 hashCheckpoint);
209207
bool ReadCheckpointPubKey(std::string& strPubKey);
210208
bool WriteCheckpointPubKey(const std::string& strPubKey);
211-
bool ReadModifierUpgradeTime(unsigned int& nUpgradeTime);
212-
bool WriteModifierUpgradeTime(const unsigned int& nUpgradeTime);
213209
bool LoadBlockIndex();
214210
private:
215211
bool LoadBlockIndexGuts();

0 commit comments

Comments
 (0)