Hi, I cannot close a channel with either the rest API or lncli...
Rest API:
Client error: `DELETE https://lightningsale:***@lnd:8080/v1/channels/1198623c07ceb98ccfe4674e74d1f7b22840cc805e1a9491e9d17b88c32d98ec/0` resulted in a `400 Bad Request` response:
{"error":"type mismatch, parameter: channel_point.funding_txid, error: unsupported field type uint8","code":3}
Rest API (output index 1):
Client error: `DELETE https://lightningsale:***@lnd:8080/v1/channels/1198623c07ceb98ccfe4674e74d1f7b22840cc805e1a9491e9d17b88c32d98ec/1` resulted in a `400 Bad Request` response:
{"error":"type mismatch, parameter: channel_point.funding_txid, error: unsupported field type uint8","code":3}
Please advice :)
Also how do I force close a channel over Rest?
What is the result of the lncli command you are using?
It works nicely :)
Closing via rest gave this result:
Client error: `DELETE https://lightningsale:***@lnd:8080/v1/channels/093a53310dffb963da5887abcc397227a6f70a355c86d75a6256719bb340869b/0` resulted in a `400 Bad Request` response:
{"error":"type mismatch, parameter: channel_point.funding_txid, error: unsupported field type uint8","code":3}
lncli:
docker-compose exec lnd lncli closechannel 093a53310dffb963da5887abcc397227a6f70a355c86d75a6256719bb340869b
{
"closing_txid": "c076966d9069ffd70583e3f0165d302e0c1dafc35dd273b3cd23e347cd61d9e1"
}
I think the cause of this problem is that the type of the channel_point.funding_txid is bytes, but there is a known bug with the grpc-gateway when using PopulateFieldFromPath on a bytes field.
Fixing grpc-gateway seems ideal, but it seems that there is already a duplicate string field that could maybe be used instead - though I'm not sure how.
I've been working on a patch to fix this. I have a working implementation using the string field @MDrollette was referring by merging the bytes and string field into protobuf's variant type oneof. I just need to tidy up a few more things before submitting a PR.
@Richard87, as for force closing a channel, you need to append ?force=true to the end of the request URL. Following your example, you can use curl to force close a channel with:
$ curl --insecure -X DELETE "https://lightningsale:***@lnd:8080/v1/channels/093a53310dffb963da5887abcc397227a6f70a355c86d75a6256719bb340869b/0?force=true"
You can actually use the other optional parameters available to close a channel, like target_conf and sat_per_byte by following the usual parameter style:
?force=true&target_conf=5&sat_per_byte=10
Unfortunately, we are lacking documentation for this kind of stuff. I'll probably put some time aside to include optional parameters for every RPC call in the docs.
I'm pretty sure I tested with ?force=true, but I'll give it a second try!
Should all the optional parameters work "out of the box", or does it need more code?
Well it won't work yet, as the issue is still with parsing the channel_point.funding_txid as a []byte. This should be resolved with my patch.
As for the other optional parameters, they should all work out of the box.
Fixed by #592.
Oops, that's not merged yet. Re-opening :p
Most helpful comment
I've been working on a patch to fix this. I have a working implementation using the string field @MDrollette was referring by merging the
bytesandstringfield intoprotobuf's variant typeoneof. I just need to tidy up a few more things before submitting a PR.@Richard87, as for force closing a channel, you need to append
?force=trueto the end of the request URL. Following your example, you can usecurlto force close a channel with:You can actually use the other optional parameters available to close a channel, like
target_confandsat_per_byteby following the usual parameter style:?force=true&target_conf=5&sat_per_byte=10Unfortunately, we are lacking documentation for this kind of stuff. I'll probably put some time aside to include optional parameters for every RPC call in the docs.