mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
parent
e1772ce08a
commit
26a9ea539f
2 changed files with 4 additions and 6 deletions
|
|
@ -366,10 +366,12 @@ func (test *snapshotTest) run() bool {
|
||||||
state, _ = New(types.EmptyRootHash, NewDatabase(db))
|
state, _ = New(types.EmptyRootHash, NewDatabase(db))
|
||||||
snapshotRevs = make([]int, len(test.snapshots))
|
snapshotRevs = make([]int, len(test.snapshots))
|
||||||
sindex = 0
|
sindex = 0
|
||||||
|
checkstates = make([]*StateDB, len(test.snapshots))
|
||||||
)
|
)
|
||||||
for i, action := range test.actions {
|
for i, action := range test.actions {
|
||||||
if len(test.snapshots) > sindex && i == test.snapshots[sindex] {
|
if len(test.snapshots) > sindex && i == test.snapshots[sindex] {
|
||||||
snapshotRevs[sindex] = state.Snapshot()
|
snapshotRevs[sindex] = state.Snapshot()
|
||||||
|
checkstates[sindex] = state.Copy()
|
||||||
sindex++
|
sindex++
|
||||||
}
|
}
|
||||||
action.fn(action, state)
|
action.fn(action, state)
|
||||||
|
|
@ -377,12 +379,8 @@ func (test *snapshotTest) run() bool {
|
||||||
// Revert all snapshots in reverse order. Each revert must yield a state
|
// Revert all snapshots in reverse order. Each revert must yield a state
|
||||||
// that is equivalent to fresh state with all actions up the snapshot applied.
|
// that is equivalent to fresh state with all actions up the snapshot applied.
|
||||||
for sindex--; sindex >= 0; sindex-- {
|
for sindex--; sindex >= 0; sindex-- {
|
||||||
checkstate, _ := New(types.EmptyRootHash, state.Database())
|
|
||||||
for _, action := range test.actions[:test.snapshots[sindex]] {
|
|
||||||
action.fn(action, checkstate)
|
|
||||||
}
|
|
||||||
state.RevertToSnapshot(snapshotRevs[sindex])
|
state.RevertToSnapshot(snapshotRevs[sindex])
|
||||||
if err := test.checkEqual(state, checkstate); err != nil {
|
if err := test.checkEqual(state, checkstates[sindex]); err != nil {
|
||||||
test.err = fmt.Errorf("state mismatch after revert to snapshot %d\n%v", sindex, err)
|
test.err = fmt.Errorf("state mismatch after revert to snapshot %d\n%v", sindex, err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,7 @@ func TestClientSubscriptionChannelClose(t *testing.T) {
|
||||||
|
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
ch := make(chan int, 100)
|
ch := make(chan int, 100)
|
||||||
sub, err := client.Subscribe(context.Background(), "nftest", ch, "someSubscription", maxClientSubscriptionBuffer-1, 1)
|
sub, err := client.Subscribe(context.Background(), "nftest", ch, "someSubscription", 100, 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue