Changeset View
Changeset View
Standalone View
Standalone View
src/index/txindex.cpp
Show All 12 Lines | |||||
#include <boost/thread.hpp> | #include <boost/thread.hpp> | ||||
constexpr char DB_BEST_BLOCK = 'B'; | constexpr char DB_BEST_BLOCK = 'B'; | ||||
constexpr char DB_TXINDEX = 't'; | constexpr char DB_TXINDEX = 't'; | ||||
constexpr char DB_TXINDEX_BLOCK = 'T'; | constexpr char DB_TXINDEX_BLOCK = 'T'; | ||||
std::unique_ptr<TxIndex> g_txindex; | std::unique_ptr<TxIndex> g_txindex; | ||||
struct CDiskTxPos : public CDiskBlockPos { | struct CDiskTxPos : public FlatFilePos { | ||||
unsigned int nTxOffset; // after header | unsigned int nTxOffset; // after header | ||||
ADD_SERIALIZE_METHODS; | ADD_SERIALIZE_METHODS; | ||||
template <typename Stream, typename Operation> | template <typename Stream, typename Operation> | ||||
inline void SerializationOp(Stream &s, Operation ser_action) { | inline void SerializationOp(Stream &s, Operation ser_action) { | ||||
READWRITEAS(CDiskBlockPos, *this); | READWRITEAS(FlatFilePos, *this); | ||||
READWRITE(VARINT(nTxOffset)); | READWRITE(VARINT(nTxOffset)); | ||||
} | } | ||||
CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn) | CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) | ||||
: CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {} | : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {} | ||||
CDiskTxPos() { SetNull(); } | CDiskTxPos() { SetNull(); } | ||||
void SetNull() { | void SetNull() { | ||||
CDiskBlockPos::SetNull(); | FlatFilePos::SetNull(); | ||||
nTxOffset = 0; | nTxOffset = 0; | ||||
} | } | ||||
}; | }; | ||||
/** | /** | ||||
* Access to the txindex database (indexes/txindex/) | * Access to the txindex database (indexes/txindex/) | ||||
* | * | ||||
* The database stores a block locator of the chain the database is synced to | * The database stores a block locator of the chain the database is synced to | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |