Merge pull request #928 from nspcc-dev/fix-rpc-submitblock-test

Fix RPC submitblock test
This commit is contained in:
Roman Khimov 2020-05-06 14:47:44 +03:00 committed by GitHub
commit d5c471b087
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)
})
@ -1091,6 +1092,7 @@ func checkErrGetResult(t *testing.T, body []byte, expectingFail bool) json.RawMe
err := json.Unmarshal(body, &resp)
require.Nil(t, err)
if expectingFail {
require.NotNil(t, resp.Error)
assert.NotEqual(t, 0, resp.Error.Code)
assert.NotEqual(t, "", resp.Error.Message)
} else {