mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-16 01:16:29 +00:00
rpcsrv: handle block aer errors in getblocknotifications
Ignoring them is not correct. Notice that block-level aers are always present and if filtering returns nothing the value of the resulting slice still remains nil, so the behavior is the same. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
cb4aba497e
commit
d1926e4fb0
1 changed files with 6 additions and 4 deletions
|
@ -3239,9 +3239,10 @@ func (s *Server) getBlockNotifications(reqParams params.Params) (any, *neorpc.Er
|
|||
notifications := &result.BlockNotifications{}
|
||||
|
||||
aers, err := s.chain.GetAppExecResults(block.Hash(), trigger.OnPersist)
|
||||
if err == nil && len(aers) > 0 {
|
||||
notifications.PrePersistNotifications = processAppExecResults([]state.AppExecResult{aers[0]}, filter)
|
||||
if err != nil {
|
||||
return nil, neorpc.NewInternalServerError("failed to get app exec results for onpersist")
|
||||
}
|
||||
notifications.PrePersistNotifications = processAppExecResults([]state.AppExecResult{aers[0]}, filter)
|
||||
|
||||
for _, txHash := range block.Transactions {
|
||||
aers, err := s.chain.GetAppExecResults(txHash.Hash(), trigger.Application)
|
||||
|
@ -3252,9 +3253,10 @@ func (s *Server) getBlockNotifications(reqParams params.Params) (any, *neorpc.Er
|
|||
}
|
||||
|
||||
aers, err = s.chain.GetAppExecResults(block.Hash(), trigger.PostPersist)
|
||||
if err == nil && len(aers) > 0 {
|
||||
notifications.PostPersistNotifications = processAppExecResults([]state.AppExecResult{aers[0]}, filter)
|
||||
if err != nil {
|
||||
return nil, neorpc.NewInternalServerError("failed to get app exec results for postpersist")
|
||||
}
|
||||
notifications.PostPersistNotifications = processAppExecResults([]state.AppExecResult{aers[0]}, filter)
|
||||
|
||||
return notifications, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue