fix error "could not apply NextKey for the empty key" (#753)

This commit is contained in:
Alex Sharov 2020-07-17 06:59:22 +07:00 committed by GitHub
parent 086435117f
commit 4d54f0ec0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,7 +77,7 @@ func promoteHashedStateCleanly(s *StageState, db ethdb.Database, to uint64, data
skipCurrentState := false
if len(s.StageData) == 1 && s.StageData[0] == byte(0xFF) {
skipCurrentState = true
} else if len(s.StageData) > 0 {
} else if len(s.StageData) > 1 {
loadStartKey, err = etl.NextKey(s.StageData[1:])
if err != nil {
return err
@ -117,7 +117,7 @@ func promoteHashedStateCleanly(s *StageState, db ethdb.Database, to uint64, data
return append([]byte{0xCD}, k...)
}
if len(s.StageData) > 0 && s.StageData[0] == byte(0xCD) {
if len(s.StageData) > 1 && s.StageData[0] == byte(0xCD) {
loadStartKey, err = etl.NextKey(s.StageData[1:])
if err != nil {
return err