Require CBlockIndex::GetUndoPos() to hold mutex cs_main
This commit is contained in:
2 files changed
+4
-2
No files matched your search
+2
-1
@@ -237,8 +237,9 @@ public:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatFilePos GetUndoPos() const
|
FlatFilePos GetUndoPos() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
|
||||||
{
|
{
|
||||||
|
AssertLockHeld(::cs_main);
|
||||||
FlatFilePos ret;
|
FlatFilePos ret;
|
||||||
if (nStatus & BLOCK_HAVE_UNDO) {
|
if (nStatus & BLOCK_HAVE_UNDO) {
|
||||||
ret.nFile = nFile;
|
ret.nFile = nFile;
|
||||||
|
|||||||
@@ -513,7 +513,8 @@ static bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const
|
|||||||
|
|
||||||
bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
|
bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
|
||||||
{
|
{
|
||||||
FlatFilePos pos = pindex->GetUndoPos();
|
const FlatFilePos pos{WITH_LOCK(::cs_main, return pindex->GetUndoPos())};
|
||||||
|
|
||||||
if (pos.IsNull()) {
|
if (pos.IsNull()) {
|
||||||
return error("%s: no undo data available", __func__);
|
return error("%s: no undo data available", __func__);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user