diff --git a/pkg/snapshot/service_test.go b/pkg/snapshot/service_test.go index f1263fe..7fdfda3 100644 --- a/pkg/snapshot/service_test.go +++ b/pkg/snapshot/service_test.go @@ -44,7 +44,8 @@ func TestCreateSnapshot(t *testing.T) { pub.EXPECT().PrepareTxForBatch(gomock.Any(), gomock.Any()).Return(tx, nil). AnyTimes() pub.EXPECT().PublishStateNode(gomock.Any(), gomock.Any(), gomock.Any()). - Times(len(fixt.Block1_StateNodePaths)) + // Use MinTimes as duplicate nodes are expected at boundaries + MinTimes(len(fixt.Block1_StateNodePaths)) // TODO: fixtures for storage node // pub.EXPECT().PublishStorageNode(gomock.Eq(fixt.StorageNode), gomock.Eq(int64(0)), gomock.Any()) diff --git a/pkg/snapshot/tracker.go b/pkg/snapshot/tracker.go index 1e5fbdf..8ca9b34 100644 --- a/pkg/snapshot/tracker.go +++ b/pkg/snapshot/tracker.go @@ -137,7 +137,11 @@ func (tr *iteratorTracker) restore(tree state.Trie) ([]trie.NodeIterator, error) } } - it := iter.NewPrefixBoundIterator(tree, paths[0], paths[1]) + // Force the lower bound path to an even length + if len(paths[0])&0b1 == 1 { + paths[0] = append(paths[0], 0) + } + it := iter.NewPrefixBoundIterator(tree.NodeIterator(iter.HexToKeyBytes(paths[0])), paths[1]) ret = append(ret, tr.tracked(it)) } return ret, nil