mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
test:delete-no-use-param
This commit is contained in:
parent
f20f06e7e2
commit
f5ab92b695
1 changed files with 5 additions and 9 deletions
|
|
@ -36,7 +36,7 @@ import (
|
||||||
|
|
||||||
var dumper = spew.ConfigState{Indent: " "}
|
var dumper = spew.ConfigState{Indent: " "}
|
||||||
|
|
||||||
func accountRangeTest(t *testing.T, trie *state.Trie, statedb *state.StateDB, start common.Hash, requestedNum int, expectedNum int) state.Dump {
|
func accountRangeTest(t *testing.T, statedb *state.StateDB, start common.Hash, requestedNum int, expectedNum int) state.Dump {
|
||||||
result := statedb.RawDump(&state.DumpConfig{
|
result := statedb.RawDump(&state.DumpConfig{
|
||||||
SkipCode: true,
|
SkipCode: true,
|
||||||
SkipStorage: true,
|
SkipStorage: true,
|
||||||
|
|
@ -83,14 +83,10 @@ func TestAccountRange(t *testing.T) {
|
||||||
root, _ := sdb.Commit(0, true)
|
root, _ := sdb.Commit(0, true)
|
||||||
sdb, _ = state.New(root, statedb, nil)
|
sdb, _ = state.New(root, statedb, nil)
|
||||||
|
|
||||||
trie, err := statedb.OpenTrie(root)
|
accountRangeTest(t, sdb, common.Hash{}, AccountRangeMaxResults/2, AccountRangeMaxResults/2)
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
accountRangeTest(t, &trie, sdb, common.Hash{}, AccountRangeMaxResults/2, AccountRangeMaxResults/2)
|
|
||||||
// test pagination
|
// test pagination
|
||||||
firstResult := accountRangeTest(t, &trie, sdb, common.Hash{}, AccountRangeMaxResults, AccountRangeMaxResults)
|
firstResult := accountRangeTest(t, sdb, common.Hash{}, AccountRangeMaxResults, AccountRangeMaxResults)
|
||||||
secondResult := accountRangeTest(t, &trie, sdb, common.BytesToHash(firstResult.Next), AccountRangeMaxResults, AccountRangeMaxResults)
|
secondResult := accountRangeTest(t, sdb, common.BytesToHash(firstResult.Next), AccountRangeMaxResults, AccountRangeMaxResults)
|
||||||
|
|
||||||
hList := make([]common.Hash, 0)
|
hList := make([]common.Hash, 0)
|
||||||
for addr1, acc := range firstResult.Accounts {
|
for addr1, acc := range firstResult.Accounts {
|
||||||
|
|
@ -108,7 +104,7 @@ func TestAccountRange(t *testing.T) {
|
||||||
// set and get an even split between the first and second sets.
|
// set and get an even split between the first and second sets.
|
||||||
slices.SortFunc(hList, common.Hash.Cmp)
|
slices.SortFunc(hList, common.Hash.Cmp)
|
||||||
middleH := hList[AccountRangeMaxResults/2]
|
middleH := hList[AccountRangeMaxResults/2]
|
||||||
middleResult := accountRangeTest(t, &trie, sdb, middleH, AccountRangeMaxResults, AccountRangeMaxResults)
|
middleResult := accountRangeTest(t, sdb, middleH, AccountRangeMaxResults, AccountRangeMaxResults)
|
||||||
missing, infirst, insecond := 0, 0, 0
|
missing, infirst, insecond := 0, 0, 0
|
||||||
for h := range middleResult.Accounts {
|
for h := range middleResult.Accounts {
|
||||||
if _, ok := firstResult.Accounts[h]; ok {
|
if _, ok := firstResult.Accounts[h]; ok {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue