mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-23 03:38:35 +00:00
rpc: fix potential getblock handling problem, add a test for it
It should only accept hex strings and numbers, anything else is wrong.
This commit is contained in:
parent
1c883cc819
commit
3843451ec4
2 changed files with 6 additions and 1 deletions
|
@ -141,7 +141,7 @@ Methods:
|
||||||
break Methods
|
break Methods
|
||||||
}
|
}
|
||||||
hash = s.chain.GetHeaderHash(num)
|
hash = s.chain.GetHeaderHash(num)
|
||||||
case defaultT:
|
default:
|
||||||
resultsErr = errInvalidParams
|
resultsErr = errInvalidParams
|
||||||
break Methods
|
break Methods
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,11 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
params: `[]`,
|
params: `[]`,
|
||||||
fail: true,
|
fail: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "bad params",
|
||||||
|
params: `[[]]`,
|
||||||
|
fail: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "invalid height",
|
name: "invalid height",
|
||||||
params: `[-1]`,
|
params: `[-1]`,
|
||||||
|
|
Loading…
Reference in a new issue