rpcsrv: check args first, get data from DB then

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2025-02-11 15:55:04 +03:00
parent d1926e4fb0
commit 93be186685

View file

@ -3213,11 +3213,6 @@ func (s *Server) getBlockNotifications(reqParams params.Params) (any, *neorpc.Er
return nil, respErr
}
block, err := s.chain.GetTrimmedBlock(hash)
if err != nil {
return nil, neorpc.ErrUnknownBlock
}
var filter *neorpc.NotificationFilter
if len(reqParams) > 1 {
var (
@ -3236,6 +3231,11 @@ func (s *Server) getBlockNotifications(reqParams params.Params) (any, *neorpc.Er
}
}
block, err := s.chain.GetTrimmedBlock(hash)
if err != nil {
return nil, neorpc.ErrUnknownBlock
}
notifications := &result.BlockNotifications{}
aers, err := s.chain.GetAppExecResults(block.Hash(), trigger.OnPersist)