rpc/server: rework submitblock empty test

The original intention here was to check for server reaction in presence of
validation errors (response.ErrValidationFailed) and it was very easy to make
validation fail for block without transactions in Neo 2. But in Neo 3
transactionless blocks are perfectly valid (see
29d321b5e1) which broke this test even though we
didn't see it until websocket addition (which required
8cec6694ae to make this test work initially).

So make a valid block and then spoil its verification script.
This commit is contained in:
Roman Khimov 2020-05-06 13:11:28 +03:00
parent fd72f0635e
commit 7287c01bd0

View file

@ -860,8 +860,9 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
t.Run("submit", func(t *testing.T) {
rpc := `{"jsonrpc": "2.0", "id": 1, "method": "submitblock", "params": ["%s"]}`
t.Run("empty", func(t *testing.T) {
t.Run("invalid signature", func(t *testing.T) {
s := newBlock(t, chain, 1)
s.Script.VerificationScript[8] ^= 0xff
body := doRPCCall(fmt.Sprintf(rpc, encodeBlock(t, s)), httpSrv.URL, t)
checkErrGetResult(t, body, true)
})