private void WsOnChange(Range target) { if (target.Row < PeersTable.StartRow || target.Row > PeersTable.EndRow || (target.Value2?.ToString() != "" && target.Value2 != null)) { return; } PeersForm.ClearErrorData(); try { var peer = PeersTable.DataList[target.Row - PeersTable.DataStartRow]; LApp.LndClient.DisconnectPeer(peer.PubKey); PeersTable.RemoveRow(target.Row); LApp.Refresh(SheetNames.Peers); } catch (RpcException e) { PeersForm.DisplayError(e); } }
private void WsOnChange(Range target) { if (target.Row < OpenChannelsTable.StartRow || target.Row > OpenChannelsTable.EndRow || (target.Value2?.ToString() != "" && target.Value2 != null)) { return; } OpenChannelForm.ClearErrorData(); var channel = OpenChannelsTable.DataList[target.Row - OpenChannelsTable.DataStartRow]; try { LApp.LndClient.CloseChannel(channel.ChannelPoint, false); OpenChannelsTable.RemoveRow(target.Row); LApp.Refresh(SheetNames.Channels); } catch (RpcException e) { if (e.Status.Detail.Contains("peer is offline")) { try { LApp.LndClient.CloseChannel(channel.ChannelPoint, true); OpenChannelsTable.RemoveRow(target.Row); LApp.Refresh(SheetNames.Channels); } catch (RpcException e2) { OpenChannelForm.DisplayError(e2); } } else { OpenChannelForm.DisplayError(e); } } }