Skip to content

Commit ac486e4

Browse files
authored
Fix full pruning crash on hash. (#7907)
1 parent f2afa1b commit ac486e4

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/Nethermind/Nethermind.Blockchain.Test/FullPruning/FullPrunerTests.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,14 @@ public TestContext(
248248
FullPruningMaxDegreeOfParallelism = degreeOfParallelism,
249249
FullPruningMemoryBudgetMb = fullScanMemoryBudgetMb,
250250
FullPruningCompletionBehavior = completionBehavior
251-
}, BlockTree, StateReader, ProcessExitSource, _chainEstimations, DriveInfo, Substitute.For<IPruningTrieStore>(), LimboLogs.Instance);
251+
},
252+
BlockTree,
253+
StateReader,
254+
ProcessExitSource,
255+
_chainEstimations,
256+
DriveInfo,
257+
new TrieStore(NodeStorage, LimboLogs.Instance),
258+
LimboLogs.Instance);
252259
}
253260

254261
public async Task RunFullPruning()

src/Nethermind/Nethermind.Trie/Pruning/TrieStore.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1004,13 +1004,13 @@ public void PersistCache(CancellationToken cancellationToken)
10041004
// need existing node will have to read back from db causing copy-on-read mechanism to copy the node.
10051005
void ClearCommitSetQueue()
10061006
{
1007-
while (_commitSetQueue.TryPeek(out BlockCommitSet commitSet) && commitSet.IsSealed)
1007+
while (CommitSetQueue.TryPeek(out BlockCommitSet commitSet) && commitSet.IsSealed)
10081008
{
1009-
if (!_commitSetQueue.TryDequeue(out commitSet)) break;
1009+
if (!CommitSetQueue.TryDequeue(out commitSet)) break;
10101010
if (!commitSet.IsSealed)
10111011
{
10121012
// Oops
1013-
_commitSetQueue.Enqueue(commitSet);
1013+
CommitSetQueue.Enqueue(commitSet);
10141014
break;
10151015
}
10161016

@@ -1019,7 +1019,7 @@ void ClearCommitSetQueue()
10191019
}
10201020
}
10211021

1022-
if (!(_commitSetQueue?.IsEmpty ?? true))
1022+
if (!CommitSetQueue.IsEmpty)
10231023
{
10241024
// We persist outside of lock first.
10251025
ClearCommitSetQueue();

src/Nethermind/Nethermind.Trie/Pruning/TrieStoreDirtyNodesCache.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ public void Dump()
406406

407407
public void ClearLivePruningTracking()
408408
{
409-
_persistedLastSeen.Clear();
409+
_persistedLastSeen?.Clear();
410410
_pastPathHash?.Clear();
411411
}
412412

0 commit comments

Comments
 (0)