From 17460648ba9a4fb6f3258f2b1bc91b671a27cd13 Mon Sep 17 00:00:00 2001 From: "will@2012" Date: Tue, 12 Mar 2024 14:36:05 +0800 Subject: [PATCH] fix: fix snapshot ut --- core/blockchain_snapshot_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/blockchain_snapshot_test.go b/core/blockchain_snapshot_test.go index dd012c430c..348cc3f473 100644 --- a/core/blockchain_snapshot_test.go +++ b/core/blockchain_snapshot_test.go @@ -483,6 +483,13 @@ func TestNoCommitCrashWithNewSnapshot(t *testing.T) { // Expected head block : G // Expected snapshot disk : C4 for _, scheme := range []string{rawdb.HashScheme, rawdb.PathScheme} { + // in hash scheme ,rewind use snapshot root and the snapshot root block number = 4. + // Last committed disk layer, wait recovery + snapshotBottom := uint64(4) + if scheme == rawdb.PathScheme { + // in path scheme, rewind use trie head as disk root and trie head block number = 0. + snapshotBottom = 0 + } test := &crashSnapshotTest{ snapshotTestBasic{ scheme: scheme, @@ -493,7 +500,7 @@ func TestNoCommitCrashWithNewSnapshot(t *testing.T) { expHeadHeader: 8, expHeadFastBlock: 8, expHeadBlock: 0, - expSnapshotBottom: 4, // Last committed disk layer, wait recovery + expSnapshotBottom: snapshotBottom, }, } test.test(t)