mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #4430 from vijaydasmp/backport_v18_vijay_batch4_1
Merge bitcoin#19733, bitcoin#19734
This commit is contained in:
commit
da26b9bff8
@ -178,6 +178,7 @@ BITCOIN_CORE_H = \
|
||||
httpserver.h \
|
||||
index/base.h \
|
||||
index/blockfilterindex.h \
|
||||
index/disktxpos.h \
|
||||
index/txindex.h \
|
||||
indirectmap.h \
|
||||
init.h \
|
||||
|
@ -22,6 +22,13 @@ class CBlockIndex;
|
||||
class BaseIndex : public CValidationInterface
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* The database stores a block locator of the chain the database is synced to
|
||||
* so that the index can efficiently determine the point it last stopped at.
|
||||
* A locator is used instead of a simple hash of the chain tip because blocks
|
||||
* and block index entries may not be flushed to disk until after this database
|
||||
* is updated.
|
||||
*/
|
||||
class DB : public CDBWrapper
|
||||
{
|
||||
public:
|
||||
|
35
src/index/disktxpos.h
Normal file
35
src/index/disktxpos.h
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_INDEX_DISKTXPOS_H
|
||||
#define BITCOIN_INDEX_DISKTXPOS_H
|
||||
|
||||
#include <flatfile.h>
|
||||
#include <serialize.h>
|
||||
|
||||
struct CDiskTxPos : public FlatFilePos
|
||||
{
|
||||
unsigned int nTxOffset; // after header
|
||||
|
||||
SERIALIZE_METHODS(CDiskTxPos, obj)
|
||||
{
|
||||
READWRITEAS(FlatFilePos, obj);
|
||||
READWRITE(VARINT(obj.nTxOffset));
|
||||
}
|
||||
|
||||
CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
|
||||
}
|
||||
|
||||
CDiskTxPos() {
|
||||
SetNull();
|
||||
}
|
||||
|
||||
void SetNull() {
|
||||
FlatFilePos::SetNull();
|
||||
nTxOffset = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // BITCOIN_INDEX_DISKTXPOS_H
|
@ -2,6 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <index/disktxpos.h>
|
||||
#include <index/txindex.h>
|
||||
#include <shutdown.h>
|
||||
#include <ui_interface.h>
|
||||
@ -16,38 +17,9 @@ constexpr char DB_TXINDEX_BLOCK = 'T';
|
||||
|
||||
std::unique_ptr<TxIndex> g_txindex;
|
||||
|
||||
struct CDiskTxPos : public FlatFilePos
|
||||
{
|
||||
unsigned int nTxOffset; // after header
|
||||
|
||||
SERIALIZE_METHODS(CDiskTxPos, obj)
|
||||
{
|
||||
READWRITEAS(FlatFilePos, obj);
|
||||
READWRITE(VARINT(obj.nTxOffset));
|
||||
}
|
||||
|
||||
CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
|
||||
}
|
||||
|
||||
CDiskTxPos() {
|
||||
SetNull();
|
||||
}
|
||||
|
||||
void SetNull() {
|
||||
FlatFilePos::SetNull();
|
||||
nTxOffset = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Access to the txindex database (indexes/txindex/)
|
||||
*
|
||||
* The database stores a block locator of the chain the database is synced to
|
||||
* so that the TxIndex can efficiently determine the point it last stopped at.
|
||||
* A locator is used instead of a simple hash of the chain tip because blocks
|
||||
* and block index entries may not be flushed to disk until after this database
|
||||
* is updated.
|
||||
*/
|
||||
/** Access to the txindex database (indexes/txindex/) */
|
||||
class TxIndex::DB : public BaseIndex::DB
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user