<ul>
<li>Why does p2 not auto-select the funded channel?</li>
</ul>
<p>In this case, I guess that the pay plugin is smart enough to select the peer with the correct channel, or better is not able to choose the right channel of the peer. I guess this is a limitation of the pay plugin, also if I do not remember the code, maybe if you open an issue we can take a look at what is going on in your case!</p>
<ul>
<li>Is there a way to select the channel? I did not find an option for payment.</li>
</ul>
<p>Yes you can use the <code>sendpay</code> command that allows you to specify the route, this is a low-level command but it is a good way to have the power to choose the route</p>

CC BY-SA 4.0
2023-02-18T12:25:04.313Z
2023-02-18T12:25:04.313Z
vincenzopalazzo
<h2>Description</h2>
<p>I have two peers: p1 and p2 running lightning-core</p>
<p>p1 opened a channel to p2 and p2 opened another channel to p1.</p>
<p>Now p2 has two channels. One with outbound funding and one with 0. Output of <code>listfunds</code>:</p>
<pre><code>&quot;channels&quot;: [      
      {
         &quot;peer_id&quot;: &quot;02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93&quot;,
         &quot;connected&quot;: true,
         &quot;state&quot;: &quot;CHANNELD_NORMAL&quot;,
         &quot;short_channel_id&quot;: &quot;2410508x70x0&quot;,
         &quot;channel_sat&quot;: 0,
         &quot;our_amount_msat&quot;: &quot;0msat&quot;,
         &quot;channel_total_sat&quot;: 113495,
         &quot;amount_msat&quot;: &quot;113495000msat&quot;,
         &quot;funding_txid&quot;: &quot;1f5284dbfcaf76e8a333c1c607465a9474294f43cfbcbbb34504d97aac2189a4&quot;,
         &quot;funding_output&quot;: 0
      },
      {
         &quot;peer_id&quot;: &quot;02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93&quot;,
         &quot;connected&quot;: true,
         &quot;state&quot;: &quot;CHANNELD_NORMAL&quot;,
         &quot;short_channel_id&quot;: &quot;2410509x222x0&quot;,
         &quot;channel_sat&quot;: 90433,
         &quot;our_amount_msat&quot;: &quot;90433000msat&quot;,
         &quot;channel_total_sat&quot;: 90433,
         &quot;amount_msat&quot;: &quot;90433000msat&quot;,
         &quot;funding_txid&quot;: &quot;befde7cbd4965f21fe9df3a1f06eb1968109a7246457aabed58bfe39f6694b08&quot;,
         &quot;funding_output&quot;: 0
      }
   ]
</code></pre>
<h2>Problem</h2>
<p>Now I tried to <code>pay</code> a 1000msat p1 invoice from p2 and get the error:</p>
<blockquote>
<p>failed: WIRE_TEMPORARY_CHANNEL_FAILURE (WIRE_TEMPORARY_CHANNEL_FAILURE: Capacity exceeded - HTLC fee: 183sat)</p>
</blockquote>
<p>I think this is because p2 tries to send using the not funded channel <code>2410508x70x0</code>. Because if I delete this channel, all works as expected.</p>
<p>Additional information:</p>
<p>Also <code>getroute</code> shows that channel 2410508x70x0 is used:</p>
<pre><code>$ lightning-cli --testnet getroute 02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93 1000 0
{
   &quot;route&quot;: [
      {
         &quot;id&quot;: &quot;02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93&quot;,
         &quot;channel&quot;: &quot;2410508x70x0&quot;,
         &quot;direction&quot;: 1,
         &quot;msatoshi&quot;: 1000,
         &quot;amount_msat&quot;: &quot;1000msat&quot;,
         &quot;delay&quot;: 9,
         &quot;style&quot;: &quot;tlv&quot;
      }
   ]
}
</code></pre>
<h2>Questions</h2>
<ul>
<li>Why does p2 does not auto select the funded channel?</li>
<li>Is there a way to select the channel? I did not find an option for <code>pay</code>.</li>
</ul>

CC BY-SA 4.0
2022-12-09T16:29:13.773Z
Is it possible that https://blockstream.info/testnet/tx/befde7cbd4965f21fe9df3a1f06eb1968109a7246457aabed58bfe39f6694b08 didn't have three confirmations yet, when you tried to make that payment?—Does it work meanwhile?
Murch
CC BY-SA 4.0
2022-12-09T17:05:05.600Z
Tried once again with the same channel, still the same error. (the one I deleted was from a previous test).
timmornYE
CC BY-SA 4.0
2022-12-09T17:46:28.273Z
Please look at additional information. Also, `getroute` shows that the wrong channel is used.
timmornYE
<lightning-network><core-lightning>
Lightning node with two channels to peer not able to select funded channel
timmornYE
# Lightning node with two channels to peer not able to select funded channel

(Asked by: username_0 on 2022-12-09)

Description
I have two peers: p1 and p2 running lightning-core
p1 opened a channel to p2 and p2 opened another channel to p1.
Now p2 has two channels. One with outbound funding and one with 0. Output of listfunds:
"channels": [      
      {
         "peer_id": "02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93",
         "connected": true,
         "state": "CHANNELD_NORMAL",
         "short_channel_id": "2410508x70x0",
         "channel_sat": 0,
         "our_amount_msat": "0msat",
         "channel_total_sat": 113495,
         "amount_msat": "113495000msat",
         "funding_txid": "1f5284dbfcaf76e8a333c1c607465a9474294f43cfbcbbb34504d97aac2189a4",
         "funding_output": 0
      },
      {
         "peer_id": "02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93",
         "connected": true,
         "state": "CHANNELD_NORMAL",
         "short_channel_id": "2410509x222x0",
         "channel_sat": 90433,
         "our_amount_msat": "90433000msat",
         "channel_total_sat": 90433,
         "amount_msat": "90433000msat",
         "funding_txid": "befde7cbd4965f21fe9df3a1f06eb1968109a7246457aabed58bfe39f6694b08",
         "funding_output": 0
      }
   ]

Problem
Now I tried to pay a 1000msat p1 invoice from p2 and get the error:

failed: WIRE_TEMPORARY_CHANNEL_FAILURE (WIRE_TEMPORARY_CHANNEL_FAILURE: Capacity exceeded - HTLC fee: 183sat)

I think this is because p2 tries to send using the not funded channel 2410508x70x0. Because if I delete this channel, all works as expected.
Additional information:
Also getroute shows that channel 2410508x70x0 is used:
$ lightning-cli --testnet getroute 02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93 1000 0
{
   "route": [
      {
         "id": "02e7b2196a87513ef322fc2c23d5739ed4ac696a9010a855dbfe7185fe8e133c93",
         "channel": "2410508x70x0",
         "direction": 1,
         "msatoshi": 1000,
         "amount_msat": "1000msat",
         "delay": 9,
         "style": "tlv"
      }
   ]
}

Questions

Why does p2 does not auto select the funded channel?
Is there a way to select the channel? I did not find an option for pay.

**Tags:** lightning-network, core-lightning

> **Comments:**
> **username_1**: Is it possible that https://blockstream.info/testnet/tx/befde7cbd4965f21fe9df3a1f06eb1968109a7246457aabed58bfe39f6694b08 didn't have three confirmations yet, when you tried to make that payment?—Does it work meanwhile?  
> **username_0**: Tried once again with the same channel, still the same error. (the one I deleted was from a previous test).  
> **username_0**: Please look at additional information. Also, `getroute` shows that the wrong channel is used.  

---

## 1 answers

### Answer by username_2 on 2023-02-18. Score: 1 | Accepted answer

* Why does p2 not auto-select the funded channel?

In this case, I guess that the pay plugin is smart enough to select the peer with the correct channel, or better is not able to choose the right channel of the peer. I guess this is a limitation of the pay plugin, also if I do not remember the code, maybe if you open an issue we can take a look at what is going on in your case!

* Is there a way to select the channel? I did not find an option for payment.

Yes you can use the `sendpay` command that allows you to specify the route, this is a low-level command but it is a good way to have the power to choose the route


---

