try to fix hanging iterator
This commit is contained in:
parent
7129044eae
commit
3e24972a89
@ -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())
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user