Skip to content

Commit fa11c03

Browse files
author
MarcoFalke
committed
refactor: Expose UndoReadFromDisk in header
1 parent 2c336a9 commit fa11c03

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/validation.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
#include <txmempool.h>
3737
#include <ui_interface.h>
3838
#include <undo.h>
39-
#include <util/system.h>
4039
#include <util/moneystr.h>
4140
#include <util/strencodings.h>
41+
#include <util/system.h>
4242
#include <validationinterface.h>
4343
#include <warnings.h>
4444

@@ -1455,9 +1455,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
14551455
return true;
14561456
}
14571457

1458-
namespace {
1459-
1460-
bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart)
1458+
static bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart)
14611459
{
14621460
// Open history file to append
14631461
CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION);
@@ -1484,7 +1482,7 @@ bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint25
14841482
return true;
14851483
}
14861484

1487-
static bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex *pindex)
1485+
bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
14881486
{
14891487
FlatFilePos pos = pindex->GetUndoPos();
14901488
if (pos.IsNull()) {
@@ -1533,8 +1531,6 @@ static bool AbortNode(CValidationState& state, const std::string& strMessage, co
15331531
return state.Error(strMessage);
15341532
}
15351533

1536-
} // namespace
1537-
15381534
/**
15391535
* Restore the UTXO in a Coin at a given COutPoint
15401536
* @param undo The Coin to be restored.

src/validation.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <versionbits.h>
2222

2323
#include <algorithm>
24+
#include <atomic>
2425
#include <exception>
2526
#include <map>
2627
#include <memory>
@@ -30,10 +31,9 @@
3031
#include <utility>
3132
#include <vector>
3233

33-
#include <atomic>
34-
3534
class CBlockIndex;
3635
class CBlockTreeDB;
36+
class CBlockUndo;
3737
class CChainParams;
3838
class CCoinsViewDB;
3939
class CInv;
@@ -391,6 +391,8 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus
391391
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos, const CMessageHeader::MessageStartChars& message_start);
392392
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const CBlockIndex* pindex, const CMessageHeader::MessageStartChars& message_start);
393393

394+
bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex);
395+
394396
/** Functions for validating blocks and updating the block tree */
395397

396398
/** Context-independent validity checks */

0 commit comments

Comments
 (0)