You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FundChannel method in the REST API is currently implemented as a GET method, but this is semantically incorrect as it performs a state-changing operation (funding a channel). Moreover, the GET implementation fails to function even when used as intended, returning a malformed public key error.
This issue renders the method unusable and violates RESTful principles. The method should be implemented as a POST and accept the FundChannelRequest object in the body of the request.
{
"code": 12,
"message": "Method Not Allowed",
"details": []
}
Expected behavior
The FundChannel method should:
Be implemented as a POST REST method.
Accept the FundChannelRequest object in the request body.
Successfully process the request and return a valid response.
Actual behavior
The current implementation:
Uses the GET method, which is semantically incorrect for a state-changing operation.
Fails to parse query parameters correctly, resulting in an error: "error parsing peer pubkey: malformed public key: invalid length: 0".
Does not work when attempted as a POST, returning "Method Not Allowed".
Possible Cause of the Issue
Default Behavior of grpc-gateway:
The gRPC-Gateway plugin maps RPC methods to HTTP methods (GET, POST, etc.) based on the request message's fields when no explicit google.api.http annotation is provided in the .proto file. In this case, the FundChannelRequest message contains scalar fields (e.g., uint64, bytes), which can be represented as query parameters. As a result, gRPC-Gateway defaults to mapping this RPC method to GET.
The text was updated successfully, but these errors were encountered:
Background
The
FundChannel
method in the REST API is currently implemented as aGET
method, but this is semantically incorrect as it performs a state-changing operation (funding a channel). Moreover, theGET
implementation fails to function even when used as intended, returning a malformed public key error.This issue renders the method unusable and violates RESTful principles. The method should be implemented as a
POST
and accept theFundChannelRequest
object in the body of the request.Your environment
Steps to reproduce
5.Observe the response:
Expected behavior
The
FundChannel
method should:POST
REST method.Actual behavior
The current implementation:
GET
method, which is semantically incorrect for a state-changing operation.POST
, returning "Method Not Allowed".Possible Cause of the Issue
Default Behavior of grpc-gateway:
The gRPC-Gateway plugin maps RPC methods to HTTP methods (
GET
,POST
, etc.) based on the request message's fields when no explicitgoogle.api.http
annotation is provided in the.proto
file. In this case, theFundChannelRequest
message contains scalar fields (e.g.,uint64
,bytes
), which can be represented as query parameters. As a result, gRPC-Gateway defaults to mapping this RPC method toGET
.The text was updated successfully, but these errors were encountered: