eth: ensure from<to when tracing chain (credits Chen Nan via bugbounty) (#251)

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
wgr523 2023-05-25 12:22:23 +08:00 committed by GitHub
parent 62de42db68
commit 2f10aac60f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,6 +121,9 @@ func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.Block
if to == nil {
return nil, fmt.Errorf("end block #%d not found", end)
}
if from.Number().Cmp(to.Number()) >= 0 {
return nil, fmt.Errorf("end block (#%d) needs to come after start block (#%d)", end, start)
}
return api.traceChain(ctx, from, to, config)
}