瀏覽代碼

返回结构更新

skyfffire 2 年之前
父節點
當前提交
78bee9f028
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      internal/ethapi/api.go

+ 4 - 3
internal/ethapi/api.go

@@ -972,7 +972,8 @@ type BatchCallArgs struct {
 // CallResult is the result of one call.
 type CallResult struct {
 	Return hexutil.Bytes
-	Error  string
+	Msg    string
+	Code   int8
 }
 
 // BlockChainAPI provides an API to access Ethereum blockchain data.
@@ -1031,9 +1032,9 @@ func (s *PublicBlockChainAPI) BatchCall(ctx context.Context, config BatchCallCon
 		result, err := doCall(ctx, s.b, call.CallArgs, state, header, timeout, gp, &blockContext)
 		if err != nil {
 			fmt.Fprintf(os.Stderr, "call execution reverted: %v\n\n", err)
-			results = append(results, CallResult{Return: nil, Error: err.Error()})
+			results = append(results, CallResult{Code: 0, Return: nil, Msg: err.Error()})
 		} else {
-			results = append(results, CallResult{Return: result.Return(), Error: ""})
+			results = append(results, CallResult{Code: 1, Return: result.Return(), Msg: "Success."})
 		}
 	}
 	return results, nil