forked from TrueCloudLab/neoneo-go
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
|
||||
}
|
||||
hash = s.chain.GetHeaderHash(num)
|
||||
case defaultT:
|
||||
default:
|
||||
resultsErr = errInvalidParams
|
||||
break Methods
|
||||
}
|
||||
|
|
|
@ -126,6 +126,11 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
params: `[]`,
|
||||
fail: true,
|
||||
},
|
||||
{
|
||||
name: "bad params",
|
||||
params: `[[]]`,
|
||||
fail: true,
|
||||
},
|
||||
{
|
||||
name: "invalid height",
|
||||
params: `[-1]`,
|
||||
|
|
Loading…
Reference in a new issue