aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/txdb.h')
-rw-r--r--src/txdb.h33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/txdb.h b/src/txdb.h
index 749802f0e5..ce3c39d7fe 100644
--- a/src/txdb.h
+++ b/src/txdb.h
@@ -8,15 +8,17 @@
#include "coins.h"
#include "dbwrapper.h"
+#include "chain.h"
#include <map>
#include <string>
#include <utility>
#include <vector>
-class CBlockFileInfo;
+#include <boost/function.hpp>
+
class CBlockIndex;
-struct CDiskTxPos;
+class CCoinsViewDBCursor;
class uint256;
//! -dbcache default (MiB)
@@ -26,7 +28,30 @@ static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 16384 : 1024;
//! min. -dbcache in (MiB)
static const int64_t nMinDbCache = 4;
-class CCoinsViewDBCursor;
+struct CDiskTxPos : public CDiskBlockPos
+{
+ unsigned int nTxOffset; // after header
+
+ ADD_SERIALIZE_METHODS;
+
+ template <typename Stream, typename Operation>
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ READWRITE(*(CDiskBlockPos*)this);
+ READWRITE(VARINT(nTxOffset));
+ }
+
+ CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn) : CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
+ }
+
+ CDiskTxPos() {
+ SetNull();
+ }
+
+ void SetNull() {
+ CDiskBlockPos::SetNull();
+ nTxOffset = 0;
+ }
+};
/** CCoinsView backed by the coin database (chainstate/) */
class CCoinsViewDB : public CCoinsView
@@ -83,7 +108,7 @@ public:
bool WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> > &list);
bool WriteFlag(const std::string &name, bool fValue);
bool ReadFlag(const std::string &name, bool &fValue);
- bool LoadBlockIndexGuts();
+ bool LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256&)> insertBlockIndex);
};
#endif // BITCOIN_TXDB_H