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.
3
3
// Authored by Google, Inc.
4
4
// Distributed under the MIT/X11 software license, see the accompanying
5
5
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
8
8
#define BITCOIN_LEVELDB_H
9
9
10
10
#include " main.h"
11
- #include " db.h"
12
11
#include " bignum.h"
13
12
#include < leveldb/include/leveldb/write_batch.h>
14
13
#include < leveldb/include/leveldb/db.h>
15
- #include " key.h"
16
14
#include " script.h"
17
15
#include " base58.h"
18
16
@@ -69,7 +67,7 @@ class CTxDB
69
67
CDataStream ssKey (SER_DISK, CLIENT_VERSION);
70
68
ssKey.reserve (1000 );
71
69
ssKey << key;
72
- string strValue;
70
+ std:: string strValue;
73
71
74
72
bool readFromDb = true ;
75
73
if (activeBatch) {
@@ -88,7 +86,7 @@ class CTxDB
88
86
if (status.IsNotFound ())
89
87
return false ;
90
88
// Some unexpected error.
91
- printf (" LevelDB read failure: %s\n " , status.ToString (). c_str ());
89
+ LogPrintf (" LevelDB read failure: %s\n " , status.ToString ());
92
90
return false ;
93
91
}
94
92
}
@@ -98,7 +96,7 @@ class CTxDB
98
96
SER_DISK, CLIENT_VERSION);
99
97
ssValue >> value;
100
98
}
101
- catch (const exception & ) {
99
+ catch (std:: exception &e ) {
102
100
return false ;
103
101
}
104
102
return true ;
@@ -116,14 +114,14 @@ class CTxDB
116
114
CDataStream ssValue (SER_DISK, CLIENT_VERSION);
117
115
ssValue.reserve (10000 );
118
116
ssValue << value;
119
-
117
+
120
118
if (activeBatch) {
121
119
activeBatch->Put (ssKey.str (), ssValue.str ());
122
120
return true ;
123
121
}
124
- leveldb::Status status = pdb->Delete (leveldb::WriteOptions (), ssKey.str (), ssValue.str ());
122
+ leveldb::Status status = pdb->Put (leveldb::WriteOptions (), ssKey.str (), ssValue.str ());
125
123
if (!status.ok ()) {
126
- printf (" LevelDB write failure: %s\n " , status.ToString (). c_str ());
124
+ LogPrintf (" LevelDB write failure: %s\n " , status.ToString ());
127
125
return false ;
128
126
}
129
127
return true ;
@@ -182,12 +180,12 @@ class CTxDB
182
180
bool ReadVersion (int & nVersion)
183
181
{
184
182
nVersion = 0 ;
185
- return Read (string (" version" ), nVersion);
183
+ return Read (std:: string (" version" ), nVersion);
186
184
}
187
185
188
186
bool WriteVersion (int nVersion)
189
187
{
190
- return Write (string (" version" ), nVersion);
188
+ return Write (std:: string (" version" ), nVersion);
191
189
}
192
190
193
191
bool ReadTxIndex (uint256 hash, CTxIndex& txindex);
@@ -208,8 +206,6 @@ class CTxDB
208
206
bool WriteSyncCheckpoint (uint256 hashCheckpoint);
209
207
bool ReadCheckpointPubKey (std::string& strPubKey);
210
208
bool WriteCheckpointPubKey (const std::string& strPubKey);
211
- bool ReadModifierUpgradeTime (unsigned int & nUpgradeTime);
212
- bool WriteModifierUpgradeTime (const unsigned int & nUpgradeTime);
213
209
bool LoadBlockIndex ();
214
210
private:
215
211
bool LoadBlockIndexGuts ();
0 commit comments