diff --git a/src/Makefile.am b/src/Makefile.am --- a/src/Makefile.am +++ b/src/Makefile.am @@ -135,7 +135,6 @@ core_io.h \ core_memusage.h \ cuckoocache.h \ - diskblockpos.h \ flatfile.h \ fs.h \ globals.h \ diff --git a/src/chain.h b/src/chain.h --- a/src/chain.h +++ b/src/chain.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/diskblockpos.h b/src/diskblockpos.h deleted file mode 100644 --- a/src/diskblockpos.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2018 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_DISKBLOCKPOS_H -#define BITCOIN_DISKBLOCKPOS_H - -#include -#include - -#include - -struct CDiskBlockPos { - int nFile; - unsigned int nPos; - - ADD_SERIALIZE_METHODS; - - template - inline void SerializationOp(Stream &s, Operation ser_action) { - READWRITE(VARINT(nFile)); - READWRITE(VARINT(nPos)); - } - - CDiskBlockPos() { SetNull(); } - - CDiskBlockPos(int nFileIn, unsigned int nPosIn) { - nFile = nFileIn; - nPos = nPosIn; - } - - friend bool operator==(const CDiskBlockPos &a, const CDiskBlockPos &b) { - return (a.nFile == b.nFile && a.nPos == b.nPos); - } - - friend bool operator!=(const CDiskBlockPos &a, const CDiskBlockPos &b) { - return !(a == b); - } - - void SetNull() { - nFile = -1; - nPos = 0; - } - bool IsNull() const { return (nFile == -1); } - - std::string ToString() const { - return strprintf("CBlockDiskPos(nFile=%i, nPos=%i)", nFile, nPos); - } -}; - -#endif // BITCOIN_DISKBLOCKPOS_H diff --git a/src/flatfile.h b/src/flatfile.h --- a/src/flatfile.h +++ b/src/flatfile.h @@ -1,12 +1,51 @@ -// Copyright (c) 2019 The Bitcoin Core developers +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-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_FLATFILE_H #define BITCOIN_FLATFILE_H -#include #include +#include + +#include + +struct CDiskBlockPos { + int nFile; + unsigned int nPos; + + ADD_SERIALIZE_METHODS; + + template + inline void SerializationOp(Stream &s, Operation ser_action) { + READWRITE(VARINT(nFile)); + READWRITE(VARINT(nPos)); + } + + CDiskBlockPos() { SetNull(); } + + CDiskBlockPos(int nFileIn, unsigned int nPosIn) { + nFile = nFileIn; + nPos = nPosIn; + } + + friend bool operator==(const CDiskBlockPos &a, const CDiskBlockPos &b) { + return (a.nFile == b.nFile && a.nPos == b.nPos); + } + + friend bool operator!=(const CDiskBlockPos &a, const CDiskBlockPos &b) { + return !(a == b); + } + + void SetNull() { + nFile = -1; + nPos = 0; + } + bool IsNull() const { return (nFile == -1); } + + std::string ToString() const; +}; /** * FlatFileSeq represents a sequence of numbered files storing raw data. This diff --git a/src/flatfile.cpp b/src/flatfile.cpp --- a/src/flatfile.cpp +++ b/src/flatfile.cpp @@ -1,4 +1,5 @@ -// Copyright (c) 2019 The Bitcoin Core developers +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-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. @@ -16,6 +17,10 @@ } } +std::string CDiskBlockPos::ToString() const { + return strprintf("CDiskBlockPos(nFile=%i, nPos=%i)", nFile, nPos); +} + fs::path FlatFileSeq::FileName(const CDiskBlockPos &pos) const { return m_dir / strprintf("%s%05u.dat", m_prefix, pos.nFile); } diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/test/blockindex_tests.cpp b/src/test/blockindex_tests.cpp --- a/src/test/blockindex_tests.cpp +++ b/src/test/blockindex_tests.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include diff --git a/src/test/script_p2sh_tests.cpp b/src/test/script_p2sh_tests.cpp --- a/src/test/script_p2sh_tests.cpp +++ b/src/test/script_p2sh_tests.cpp @@ -11,6 +11,7 @@ #include