瀏覽代碼

修复正确结果没有返回的问题

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

+ 4 - 2
internal/ethapi/api.go

@@ -1030,8 +1030,10 @@ 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 {
 			results = append(results, CallResult{Return: nil, Error: err})
-		} else if len(result.Revert()) > 0 { // If the result contains a revert reason, try to unpack it.
-			result.Err = newRevertError(result)
+		} else {
+			if len(result.Revert()) > 0 { // If the result contains a revert reason, try to unpack it.
+				result.Err = newRevertError(result)
+			}
 
 			results = append(results, CallResult{Return: result.Return(), Error: result.Err})
 		}