forked from TrueCloudLab/neoneo-go
rpcsrv: return error on invalid proof from verifyProof
This change makes code incompatible with C# node, because currently no error is returned on invalid proof. According to proposal: https://github.com/neo-project/proposals/pull/156 Also adding `verifyProof` descpiption in docs/rpc.md. Signed-off-by: Tatiana Nesterenko <tatiana@nspcc.io>
This commit is contained in:
parent
2598257628
commit
f557959c24
2 changed files with 8 additions and 2 deletions
|
@ -196,6 +196,11 @@ enabled in the server's protocol configuration.
|
||||||
##### `getnep11transfers` and `getnep17transfers`
|
##### `getnep11transfers` and `getnep17transfers`
|
||||||
`transfernotifyindex` is not tracked by NeoGo, thus this field is always zero.
|
`transfernotifyindex` is not tracked by NeoGo, thus this field is always zero.
|
||||||
|
|
||||||
|
##### `verifyProof`
|
||||||
|
|
||||||
|
NeoGo can generate an error in response to an invalid proof, unlike
|
||||||
|
the error-free C# implementation.
|
||||||
|
|
||||||
### Unsupported methods
|
### Unsupported methods
|
||||||
|
|
||||||
Methods listed below are not going to be supported for various reasons
|
Methods listed below are not going to be supported for various reasons
|
||||||
|
|
|
@ -1531,9 +1531,10 @@ func (s *Server) verifyProof(ps params.Params) (any, *neorpc.Error) {
|
||||||
}
|
}
|
||||||
vp := new(result.VerifyProof)
|
vp := new(result.VerifyProof)
|
||||||
val, ok := mpt.VerifyProof(root, p.Key, p.Proof)
|
val, ok := mpt.VerifyProof(root, p.Key, p.Proof)
|
||||||
if ok {
|
if !ok {
|
||||||
vp.Value = val
|
return nil, neorpc.ErrInvalidProof
|
||||||
}
|
}
|
||||||
|
vp.Value = val
|
||||||
return vp, nil
|
return vp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue