Skip to content

Commit 7668db3

Browse files
committed
Move only: Move CDiskTxPos to its own file
1 parent 3ab2582 commit 7668db3

File tree

3 files changed

+39
-23
lines changed

3 files changed

+39
-23
lines changed

src/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ BITCOIN_CORE_H = \
140140
httpserver.h \
141141
index/base.h \
142142
index/blockfilterindex.h \
143+
index/disktxpos.h \
143144
index/txindex.h \
144145
indirectmap.h \
145146
init.h \

src/index/disktxpos.h

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) 2019 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_INDEX_DISKTXPOS_H
6+
#define BITCOIN_INDEX_DISKTXPOS_H
7+
8+
#include <chain.h>
9+
#include <flatfile.h>
10+
#include <primitives/block.h>
11+
#include <primitives/transaction.h>
12+
13+
struct CDiskTxPos : public FlatFilePos
14+
{
15+
unsigned int nTxOffset; // after header
16+
17+
SERIALIZE_METHODS(CDiskTxPos, obj)
18+
{
19+
READWRITEAS(FlatFilePos, obj);
20+
READWRITE(VARINT(obj.nTxOffset));
21+
}
22+
23+
CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
24+
}
25+
26+
CDiskTxPos() {
27+
SetNull();
28+
}
29+
30+
void SetNull() {
31+
FlatFilePos::SetNull();
32+
nTxOffset = 0;
33+
}
34+
};
35+
36+
37+
#endif // BITCOIN_INDEX_DISKTXPOS_H

src/index/txindex.cpp

+1-23
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
#include <index/disktxpos.h>
56
#include <index/txindex.h>
67
#include <node/ui_interface.h>
78
#include <shutdown.h>
@@ -15,29 +16,6 @@ constexpr char DB_TXINDEX_BLOCK = 'T';
1516

1617
std::unique_ptr<TxIndex> g_txindex;
1718

18-
struct CDiskTxPos : public FlatFilePos
19-
{
20-
unsigned int nTxOffset; // after header
21-
22-
SERIALIZE_METHODS(CDiskTxPos, obj)
23-
{
24-
READWRITEAS(FlatFilePos, obj);
25-
READWRITE(VARINT(obj.nTxOffset));
26-
}
27-
28-
CDiskTxPos(const FlatFilePos &blockIn, unsigned int nTxOffsetIn) : FlatFilePos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
29-
}
30-
31-
CDiskTxPos() {
32-
SetNull();
33-
}
34-
35-
void SetNull() {
36-
FlatFilePos::SetNull();
37-
nTxOffset = 0;
38-
}
39-
};
40-
4119
/**
4220
* Access to the txindex database (indexes/txindex/)
4321
*

0 commit comments

Comments
 (0)