URI: 
       tlnbase: when opening channel, test if we have enough balance first - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit c577df84898c470d45287b39ef484d16cfed4cc4
   DIR parent d511ecdc0073ba2af55a0c608ccd2b38f448ad8d
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Fri, 19 Oct 2018 21:01:32 +0200
       
       lnbase: when opening channel, test if we have enough balance first
       
       and make sure we don't try to create the funding txn from local UTXOs
       
       Diffstat:
         M electrum/lnbase.py                  |       6 +++++-
       
       1 file changed, 5 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/electrum/lnbase.py b/electrum/lnbase.py
       t@@ -394,6 +394,10 @@ class Peer(PrintError):
        
            @log_exceptions
            async def channel_establishment_flow(self, password, funding_sat, push_msat, temp_channel_id):
       +        wallet = self.lnworker.wallet
       +        # dry run creating funding tx to see if we even have enough funds
       +        funding_tx_test = wallet.mktx([TxOutput(bitcoin.TYPE_ADDRESS, wallet.dummy_address(), funding_sat)],
       +                                      password, self.lnworker.config, nonlocal_only=True)
                await self.initialized
                feerate = self.current_feerate_per_kw()
                local_config, per_commitment_secret_seed = self.make_local_config(funding_sat, push_msat, LOCAL)
       t@@ -454,7 +458,7 @@ class Peer(PrintError):
                redeem_script = funding_output_script(local_config, remote_config)
                funding_address = bitcoin.redeem_script_to_address('p2wsh', redeem_script)
                funding_output = TxOutput(bitcoin.TYPE_ADDRESS, funding_address, funding_sat)
       -        funding_tx = self.lnworker.wallet.mktx([funding_output], password, self.lnworker.config)
       +        funding_tx = wallet.mktx([funding_output], password, self.lnworker.config, nonlocal_only=True)
                funding_txid = funding_tx.txid()
                funding_index = funding_tx.outputs().index(funding_output)
                # remote commitment transaction