For example, if I open a channel with the following command:
response = lnd.lightning.open_channel({node_pubkey: pubkey, local_funding_amount: amount})
I either get a successful response with an enumerator that gives two messages, one about the act of channel opening and the second about the channel being open later on:
<Lnrpc::OpenStatusUpdate: pending_chan_id: "�M;I�%�JQ��3i{V�p���bf3���˺", chan_pending: <Lnrpc::PendingUpdate: txid: "m�#G��Fn��Dq�D��C/��/Ewt", output_index: 0>>
<Lnrpc::OpenStatusUpdate: pending_chan_id: "�M;I�%�JQ��3i{V�p���bf3���˺", chan_open: <Lnrpc::ChannelOpenUpdate: channel_point: <Lnrpc::ChannelPoint: output_index: 0, funding_txid_bytes: "m�#G��Fn��Dq�D��C/��/Ewt">>>
Otherwise I get an error response something like this:
API ERROR
An error of type GRPC::Unknown happened, message is 2:channel is too small, the minimum channel size is: 20000 SAT. debug_error_string:{"created":"@1662968827.798707000","description":"Error received from peer ipv4:34.211.6.107:10009","file":"src/core/lib/surface/call.cc","file_line":1067,"grpc_message":"channel is too small, the minimum channel size is: 20000 SAT","grpc_status":2}
My questions are:
- How do I process the
response variable in ruby to determine if the response was successful or an error?
- How do I extract
grpc_message from the error message, so I can display it to a user?
- How do I convert the byte array in the response like
�M;I�%�JQ��3i{V�p���bf3���˺ into humanely readable format?
Thank you!
For example, if I open a channel with the following command:
response = lnd.lightning.open_channel({node_pubkey: pubkey, local_funding_amount: amount})I either get a successful response with an enumerator that gives two messages, one about the act of channel opening and the second about the channel being open later on:
Otherwise I get an error response something like this:
My questions are:
responsevariable in ruby to determine if the response was successful or an error?grpc_messagefrom the error message, so I can display it to a user?�M;I�%�JQ��3i{V�p���bf3���˺into humanely readable format?Thank you!