mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
services: adjust RPC server's getHistoricParams
Update documentation and add index upper bound check to get rid of CodeQL warning.
This commit is contained in:
parent
eac5e1526e
commit
735db08f84
1 changed files with 5 additions and 2 deletions
|
@ -2002,8 +2002,8 @@ func (s *Server) getInvokeContractVerifyParams(reqParams params.Params) (util.Ui
|
|||
return scriptHash, tx, invocationScript, nil
|
||||
}
|
||||
|
||||
// getHistoricParams checks that historic calls are supported and returns fake block
|
||||
// with the specified index to perform the historic call. It also checks that
|
||||
// getHistoricParams checks that historic calls are supported and returns index of
|
||||
// a fake next block to perform the historic call. It also checks that
|
||||
// specified stateroot is stored at the specified height for further request
|
||||
// handling consistency.
|
||||
func (s *Server) getHistoricParams(reqParams params.Params) (uint32, *neorpc.Error) {
|
||||
|
@ -2030,6 +2030,9 @@ func (s *Server) getHistoricParams(reqParams params.Params) (uint32, *neorpc.Err
|
|||
height = int(b.Index)
|
||||
}
|
||||
}
|
||||
if height > math.MaxUint32 {
|
||||
return 0, neorpc.NewInvalidParamsError("historic height exceeds max uint32 value")
|
||||
}
|
||||
return uint32(height) + 1, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue