File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
venus-shared/actors/types Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -308,13 +308,25 @@ func (c *EthCall) ToFilecoinMessage() (*Message, error) {
308308}
309309
310310func (c * EthCall ) UnmarshalJSON (b []byte ) error {
311- type TempEthCall EthCall
312- var params TempEthCall
311+ type EthCallRaw EthCall // Avoid a recursive call.
312+ type EthCallDecode struct {
313+ // The field should be "input" by spec, but many clients use "data" so we support
314+ // both, but prefer "input".
315+ Input * EthBytes `json:"input"`
316+ EthCallRaw
317+ }
313318
319+ var params EthCallDecode
314320 if err := json .Unmarshal (b , & params ); err != nil {
315321 return err
316322 }
317- * c = EthCall (params )
323+
324+ // If input is specified, prefer it.
325+ if params .Input != nil {
326+ params .Data = * params .Input
327+ }
328+
329+ * c = EthCall (params .EthCallRaw )
318330 return nil
319331}
320332
You can’t perform that action at this time.
0 commit comments