فهرست منبع

返回结构更新

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