@@ -87,32 +87,32 @@ func checkTrieConsistency(db *Database, root common.Hash) error {
87
87
}
88
88
89
89
// Tests that an empty trie is not scheduled for syncing.
90
- func TestEmptyTrieSync (t * testing.T ) {
90
+ func TestEmptySync (t * testing.T ) {
91
91
dbA := NewDatabase (ethdb .NewMemDatabase ())
92
92
dbB := NewDatabase (ethdb .NewMemDatabase ())
93
93
emptyA , _ := New (common.Hash {}, dbA )
94
94
emptyB , _ := New (emptyRoot , dbB )
95
95
96
96
for i , trie := range []* Trie {emptyA , emptyB } {
97
- if req := NewTrieSync (trie .Hash (), ethdb .NewMemDatabase (), nil ).Missing (1 ); len (req ) != 0 {
97
+ if req := NewSync (trie .Hash (), ethdb .NewMemDatabase (), nil ).Missing (1 ); len (req ) != 0 {
98
98
t .Errorf ("test %d: content requested for empty trie: %v" , i , req )
99
99
}
100
100
}
101
101
}
102
102
103
103
// Tests that given a root hash, a trie can sync iteratively on a single thread,
104
104
// requesting retrieval tasks and returning all of them in one go.
105
- func TestIterativeTrieSyncIndividual (t * testing.T ) { testIterativeTrieSync (t , 1 ) }
106
- func TestIterativeTrieSyncBatched (t * testing.T ) { testIterativeTrieSync (t , 100 ) }
105
+ func TestIterativeSyncIndividual (t * testing.T ) { testIterativeSync (t , 1 ) }
106
+ func TestIterativeSyncBatched (t * testing.T ) { testIterativeSync (t , 100 ) }
107
107
108
- func testIterativeTrieSync (t * testing.T , batch int ) {
108
+ func testIterativeSync (t * testing.T , batch int ) {
109
109
// Create a random trie to copy
110
110
srcDb , srcTrie , srcData := makeTestTrie ()
111
111
112
112
// Create a destination trie and sync with the scheduler
113
113
diskdb := ethdb .NewMemDatabase ()
114
114
triedb := NewDatabase (diskdb )
115
- sched := NewTrieSync (srcTrie .Hash (), diskdb , nil )
115
+ sched := NewSync (srcTrie .Hash (), diskdb , nil )
116
116
117
117
queue := append ([]common.Hash {}, sched .Missing (batch )... )
118
118
for len (queue ) > 0 {
@@ -138,14 +138,14 @@ func testIterativeTrieSync(t *testing.T, batch int) {
138
138
139
139
// Tests that the trie scheduler can correctly reconstruct the state even if only
140
140
// partial results are returned, and the others sent only later.
141
- func TestIterativeDelayedTrieSync (t * testing.T ) {
141
+ func TestIterativeDelayedSync (t * testing.T ) {
142
142
// Create a random trie to copy
143
143
srcDb , srcTrie , srcData := makeTestTrie ()
144
144
145
145
// Create a destination trie and sync with the scheduler
146
146
diskdb := ethdb .NewMemDatabase ()
147
147
triedb := NewDatabase (diskdb )
148
- sched := NewTrieSync (srcTrie .Hash (), diskdb , nil )
148
+ sched := NewSync (srcTrie .Hash (), diskdb , nil )
149
149
150
150
queue := append ([]common.Hash {}, sched .Missing (10000 )... )
151
151
for len (queue ) > 0 {
@@ -173,17 +173,17 @@ func TestIterativeDelayedTrieSync(t *testing.T) {
173
173
// Tests that given a root hash, a trie can sync iteratively on a single thread,
174
174
// requesting retrieval tasks and returning all of them in one go, however in a
175
175
// random order.
176
- func TestIterativeRandomTrieSyncIndividual (t * testing.T ) { testIterativeRandomTrieSync (t , 1 ) }
177
- func TestIterativeRandomTrieSyncBatched (t * testing.T ) { testIterativeRandomTrieSync (t , 100 ) }
176
+ func TestIterativeRandomSyncIndividual (t * testing.T ) { testIterativeRandomSync (t , 1 ) }
177
+ func TestIterativeRandomSyncBatched (t * testing.T ) { testIterativeRandomSync (t , 100 ) }
178
178
179
- func testIterativeRandomTrieSync (t * testing.T , batch int ) {
179
+ func testIterativeRandomSync (t * testing.T , batch int ) {
180
180
// Create a random trie to copy
181
181
srcDb , srcTrie , srcData := makeTestTrie ()
182
182
183
183
// Create a destination trie and sync with the scheduler
184
184
diskdb := ethdb .NewMemDatabase ()
185
185
triedb := NewDatabase (diskdb )
186
- sched := NewTrieSync (srcTrie .Hash (), diskdb , nil )
186
+ sched := NewSync (srcTrie .Hash (), diskdb , nil )
187
187
188
188
queue := make (map [common.Hash ]struct {})
189
189
for _ , hash := range sched .Missing (batch ) {
@@ -217,14 +217,14 @@ func testIterativeRandomTrieSync(t *testing.T, batch int) {
217
217
218
218
// Tests that the trie scheduler can correctly reconstruct the state even if only
219
219
// partial results are returned (Even those randomly), others sent only later.
220
- func TestIterativeRandomDelayedTrieSync (t * testing.T ) {
220
+ func TestIterativeRandomDelayedSync (t * testing.T ) {
221
221
// Create a random trie to copy
222
222
srcDb , srcTrie , srcData := makeTestTrie ()
223
223
224
224
// Create a destination trie and sync with the scheduler
225
225
diskdb := ethdb .NewMemDatabase ()
226
226
triedb := NewDatabase (diskdb )
227
- sched := NewTrieSync (srcTrie .Hash (), diskdb , nil )
227
+ sched := NewSync (srcTrie .Hash (), diskdb , nil )
228
228
229
229
queue := make (map [common.Hash ]struct {})
230
230
for _ , hash := range sched .Missing (10000 ) {
@@ -264,14 +264,14 @@ func TestIterativeRandomDelayedTrieSync(t *testing.T) {
264
264
265
265
// Tests that a trie sync will not request nodes multiple times, even if they
266
266
// have such references.
267
- func TestDuplicateAvoidanceTrieSync (t * testing.T ) {
267
+ func TestDuplicateAvoidanceSync (t * testing.T ) {
268
268
// Create a random trie to copy
269
269
srcDb , srcTrie , srcData := makeTestTrie ()
270
270
271
271
// Create a destination trie and sync with the scheduler
272
272
diskdb := ethdb .NewMemDatabase ()
273
273
triedb := NewDatabase (diskdb )
274
- sched := NewTrieSync (srcTrie .Hash (), diskdb , nil )
274
+ sched := NewSync (srcTrie .Hash (), diskdb , nil )
275
275
276
276
queue := append ([]common.Hash {}, sched .Missing (0 )... )
277
277
requested := make (map [common.Hash ]struct {})
@@ -304,14 +304,14 @@ func TestDuplicateAvoidanceTrieSync(t *testing.T) {
304
304
305
305
// Tests that at any point in time during a sync, only complete sub-tries are in
306
306
// the database.
307
- func TestIncompleteTrieSync (t * testing.T ) {
307
+ func TestIncompleteSync (t * testing.T ) {
308
308
// Create a random trie to copy
309
309
srcDb , srcTrie , _ := makeTestTrie ()
310
310
311
311
// Create a destination trie and sync with the scheduler
312
312
diskdb := ethdb .NewMemDatabase ()
313
313
triedb := NewDatabase (diskdb )
314
- sched := NewTrieSync (srcTrie .Hash (), diskdb , nil )
314
+ sched := NewSync (srcTrie .Hash (), diskdb , nil )
315
315
316
316
added := []common.Hash {}
317
317
queue := append ([]common.Hash {}, sched .Missing (1 )... )
0 commit comments