From e5faf77d4699de7b033281d240b94c5eafdaae0a Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Sun, 24 Mar 2024 23:22:00 -0400 Subject: [PATCH] ZEUS-2062: LSP peer connect: make silent on Open Channel view --- stores/ChannelsStore.ts | 47 +++++++++++++++++++++++++---------------- stores/LSPStore.ts | 1 + 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/stores/ChannelsStore.ts b/stores/ChannelsStore.ts index a3031a6fb..d4cc1018e 100644 --- a/stores/ChannelsStore.ts +++ b/stores/ChannelsStore.ts @@ -124,18 +124,20 @@ export default class ChannelsStore { } @action - resetOpenChannel = () => { + resetOpenChannel = (silent?: boolean) => { this.loading = false; this.error = false; - this.errorPeerConnect = false; + if (!silent) { + this.errorMsgPeer = null; + this.errorPeerConnect = false; + this.connectingToPeer = false; + this.peerSuccess = false; + } this.errorMsgChannel = null; - this.errorMsgPeer = null; this.output_index = null; this.funding_txid_str = null; this.openingChannel = false; - this.connectingToPeer = false; this.errorOpenChannel = false; - this.peerSuccess = false; this.channelSuccess = false; this.channelRequest = null; }; @@ -469,11 +471,12 @@ export default class ChannelsStore { public connectPeer = async ( request: OpenChannelRequest, perm?: boolean, - connectPeerOnly?: boolean + connectPeerOnly?: boolean, + silent?: boolean ) => { - this.resetOpenChannel(); + this.resetOpenChannel(silent); this.channelRequest = undefined; - this.connectingToPeer = true; + if (!silent) this.connectingToPeer = true; if (!request.host) { return await new Promise((resolve) => { @@ -491,16 +494,20 @@ export default class ChannelsStore { perm }) .then(() => { - this.errorPeerConnect = false; - this.connectingToPeer = false; - this.errorMsgPeer = null; + if (!silent) { + this.errorPeerConnect = false; + this.connectingToPeer = false; + this.errorMsgPeer = null; + this.peerSuccess = true; + } if (!connectPeerOnly) this.channelRequest = request; - this.peerSuccess = true; resolve(true); }) .catch((error: any) => { - this.connectingToPeer = false; - this.peerSuccess = false; + if (!silent) { + this.connectingToPeer = false; + this.peerSuccess = false; + } this.channelSuccess = false; // handle error if ( @@ -510,13 +517,17 @@ export default class ChannelsStore { if (!connectPeerOnly) { this.channelRequest = request; } else { - this.errorMsgPeer = error.toString(); - this.errorPeerConnect = true; + if (!silent) { + this.errorMsgPeer = error.toString(); + this.errorPeerConnect = true; + } } resolve(true); } else { - this.errorMsgPeer = error.toString(); - this.errorPeerConnect = true; + if (!silent) { + this.errorMsgPeer = error.toString(); + this.errorPeerConnect = true; + } reject(this.errorMsgPeer); } }); diff --git a/stores/LSPStore.ts b/stores/LSPStore.ts index 5276de544..1db386988 100644 --- a/stores/LSPStore.ts +++ b/stores/LSPStore.ts @@ -85,6 +85,7 @@ export default class LSPStore { local_funding_amount: '' }, false, + true, true ); } catch (e) {}