Add a test case to reproduce the issue (#548)

This commit is contained in:
Adam Babik 2018-01-11 18:17:41 +01:00 committed by Ivan Daniluk
parent 7ab6a062ec
commit 953790c641
2 changed files with 25 additions and 1 deletions

View File

@ -146,6 +146,26 @@ func (s *RPCTestSuite) TestCallRawResult() {
s.NodeManager.StopNode() //nolint: errcheck
}
// TestCallRawResultGetTransactionReceipt checks if returned response
// for a not yet mained transaction is null.
// Issue: https://github.com/status-im/status-go/issues/547
func (s *RPCTestSuite) TestCallRawResultGetTransactionReceipt() {
nodeConfig, err := e2e.MakeTestNodeConfig(GetNetworkID())
s.NoError(err)
nodeStarted, err := s.NodeManager.StartNode(nodeConfig)
s.NoError(err)
<-nodeStarted
client := s.NodeManager.RPCClient()
s.NotNil(client)
jsonResult := client.CallRaw(`{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x0ca0d8f2422f62bea77e24ed17db5711a77fa72064cccbb8e53c53b699cd3b34"],"id":5}`)
s.Equal(`{"jsonrpc":"2.0","id":5,"result":null}`, jsonResult)
s.NodeManager.StopNode() //nolint: errcheck
}
// TestCallContextResult checks if result passed to CallContext
// is set accordingly to its underlying memory layout.
func (s *RPCTestSuite) TestCallContextResult() {

View File

@ -175,7 +175,11 @@ func newSuccessResponse(result json.RawMessage, id json.RawMessage) string {
},
Result: result,
}
data, _ := json.Marshal(msg)
data, err := json.Marshal(msg)
if err != nil {
return newErrorResponse(errInvalidMessageCode, err, id)
}
return string(data)
}