mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 09:29:38 +00:00
rpcsrv: return core.ErrVerificationFailed from calculatenetworkfee
We can ignore core.ErrInvalidSignature (which means that the script has executed, but returned false), but we shouldn't ignore other errors which likely mean that the script is incorrect (or hits some resource limits). Use neorpc.ErrInvalidSignature as a return to separate this case from contract-based verification. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
3628b824e1
commit
fd2774ea91
1 changed files with 4 additions and 1 deletions
|
@ -951,7 +951,10 @@ func (s *Server) calculateNetworkFee(reqParams params.Params) (any, *neorpc.Erro
|
|||
}
|
||||
w.InvocationScript = inv.Bytes()
|
||||
}
|
||||
gasConsumed, _ := s.chain.VerifyWitness(signer.Account, tx, &w, int64(s.config.MaxGasInvoke))
|
||||
gasConsumed, err := s.chain.VerifyWitness(signer.Account, tx, &w, int64(s.config.MaxGasInvoke))
|
||||
if err != nil && !errors.Is(err, core.ErrInvalidSignature) {
|
||||
return nil, neorpc.WrapErrorWithData(neorpc.ErrInvalidSignature, err.Error())
|
||||
}
|
||||
netFee += gasConsumed
|
||||
size += io.GetVarSize(w.VerificationScript) + io.GetVarSize(w.InvocationScript)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue