rpc: fix receipt logs (#285)
* update GetTransactionReceipt and test * change DecodeResultData err check back * change doCall back * change doCall back * add logs * remove prints
This commit is contained in:
parent
542a25ff82
commit
51b68d7512
@ -708,6 +708,10 @@ func (e *PublicEthAPI) GetTransactionReceipt(hash common.Hash) (map[string]inter
|
|||||||
status = 0 // transaction failed
|
status = 0 // transaction failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data.Logs == nil {
|
||||||
|
data.Logs = []*ethtypes.Log{}
|
||||||
|
}
|
||||||
|
|
||||||
receipt := map[string]interface{}{
|
receipt := map[string]interface{}{
|
||||||
// Consensus fields: These fields are defined by the Yellow Paper
|
// Consensus fields: These fields are defined by the Yellow Paper
|
||||||
"status": status,
|
"status": status,
|
||||||
|
@ -276,6 +276,7 @@ func sendTestTransaction(t *testing.T) hexutil.Bytes {
|
|||||||
param[0] = make(map[string]string)
|
param[0] = make(map[string]string)
|
||||||
param[0]["from"] = "0x" + fmt.Sprintf("%x", from)
|
param[0]["from"] = "0x" + fmt.Sprintf("%x", from)
|
||||||
param[0]["to"] = "0x1122334455667788990011223344556677889900"
|
param[0]["to"] = "0x1122334455667788990011223344556677889900"
|
||||||
|
param[0]["value"] = "0x1"
|
||||||
rpcRes := call(t, "eth_sendTransaction", param)
|
rpcRes := call(t, "eth_sendTransaction", param)
|
||||||
|
|
||||||
var hash hexutil.Bytes
|
var hash hexutil.Bytes
|
||||||
@ -296,6 +297,7 @@ func TestEth_GetTransactionReceipt(t *testing.T) {
|
|||||||
err := json.Unmarshal(rpcRes.Result, &receipt)
|
err := json.Unmarshal(rpcRes.Result, &receipt)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, "0x1", receipt["status"].(string))
|
require.Equal(t, "0x1", receipt["status"].(string))
|
||||||
|
require.Equal(t, []interface{}{}, receipt["logs"].([]interface{}))
|
||||||
}
|
}
|
||||||
|
|
||||||
// deployTestContract deploys a contract that emits an event in the constructor
|
// deployTestContract deploys a contract that emits an event in the constructor
|
||||||
|
Loading…
Reference in New Issue
Block a user