<p>I wrote the <code>fundchannel_start</code>/<code>fundchannel_complete</code> pathway. You <strong>should not broadcast the signed funding transaction until after you have successfully called <code>fundchannel_complete</code> for each of the peers</strong>. This is because <code>fundchannel_complete</code> secures the commitment transactions that are necessary to spend the funding transaction output for that channel. By broadcasting the transaction before you've 'completed' the channel open, there's no guarantee that you'll be able to spend those funds.</p>

<p>If you get an error in any of the <code>funchannel_complete</code>s then your entire funding transaction will have to be discarded/cancelled. There's not good support at the moment for calling <code>fundchannel_cancel</code> after <code>fundchannel_complete</code> has been called; this needs to be fixed. There's an open issue for it on c-lightning's Github repo.</p>

<p>It's highly likely that the issue you're seeing with the LND/c-lightning interop is related to the fact that you published the funding transaction before notifying them about it. You might try re-scanning the blockchain with the LND node and see if it resolves the error.</p>

CC BY-SA 4.0
2019-08-21T05:58:27.747Z
I definitely misunderstood it then, and run `fundchannel_complete` **after** sending the transaction :/. Rescanning helped c-lightning, but no such luck with lnd unfortunately (The only relevant rescan I've found with them was: https://github.com/lightningnetwork/lnd/blob/master/docs/recovery.md#forced-in-place-rescan)
meeDamian
CC BY-SA 4.0
2019-08-21T07:13:43.360Z
On a side note: perhaps `fundchannel_[pre]confirm`, or `fundchannel_ensure` would be a better name for it.
meeDamian
CC BY-SA 4.0
2019-08-21T10:09:21.793Z
Also @c2knaps, funds lost, or might be possible to recover?
meeDamian
CC BY-SA 4.0
2019-08-20T17:16:40.527Z
2019-08-20T17:16:40.527Z
c2knaps
<p>I've tried to open multiple Lightning Network channels using a single Bitcoin transaction, with these steps:</p>

<ol>
<li>For every <code>peer</code> in <code>PEERS</code> (n=25) run:</li>
</ol>



<pre><code>lightning-cli connect ${peer}
lightning-cli fundchannel_start ${peer.id} ${amount}
</code></pre>

<ol start="2">
<li>Save all returned <code>ADDRESSES</code></li>
<li>Construct a Bitcoin Transaction spending <code>${amount}</code> to each of returned <code>${ADDRESSES}</code>:</li>
</ol>



<pre><code>bitcoin-cli createrawtransaction …
bitcoin-cli signrawtransactionwithkey …
bitcoin-cli sendrawtransaction …
</code></pre>

<ol start="4">
<li>Note returned <code>txid</code></li>
<li><em>Complete</em> all channels with:</li>
</ol>



<pre><code>lightning-cli fundchannel_compete ${peer.id} ${txid} ${corresponding vout}
</code></pre>

<ol start="6">
<li>Wait for channels to open, which never happens…</li>
</ol>

<p>My regnet tests worked, but on mainnet things got stuck…</p>

<p><a href="https://blockstream.info/tx/1e643a835a9d1b0d2d0066bfaec516e2f8c282f8968dc74c12c2e430c8be9721?expand" rel="nofollow noreferrer">Relevant transaction</a>.</p>

<p><a href="https://gist.github.com/meeDamian/392e9b7339aa464afcdc2217d969e00c" rel="nofollow noreferrer">(Redacted) output</a> of <code>lightning-cli listpeers</code> for involved peers.</p>

<p>Among all of the channels that got stuck, there's one where both ends are under my control (<code>c-lightning &lt;----&gt; lnd</code>).  I'm able to test things on it:</p>

<pre><code>$ lightning-cli listpeers 03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74 | jq
{
  "peers": [
    {
      "id": "03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74",
      "connected": true,
      "netaddr": [
        "203.150.177.97:52226"
      ],
      "globalfeatures": "",
      "localfeatures": "81",
      "channels": [
        {
          "state": "CHANNELD_AWAITING_LOCKIN",
          "scratch_txid": "873bbef47e5c6dda481d62cf5b67d83170448a81e770162aedf1437d6ce16ef9",
          "owner": "lightning_channeld",
          "short_channel_id": "589813x1972x24",
          "direction": 0,
          "channel_id": "2197bec830e4c2124cc78d96f882c2f8e216c5aebf66002d0d1b9d5a833a6406",
          "funding_txid": "1e643a835a9d1b0d2d0066bfaec516e2f8c282f8968dc74c12c2e430c8be9721",
          "private": false,
          "funding_allocation_msat": {
            "03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74": 0,
            "032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e": 309735000
          },
          "funding_msat": {
            "03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74": "0msat",
            "032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e": "309735000msat"
          },
          "msatoshi_to_us": 309735000,
          "to_us_msat": "309735000msat",
          "msatoshi_to_us_min": 309735000,
          "min_to_us_msat": "309735000msat",
          "msatoshi_to_us_max": 309735000,
          "max_to_us_msat": "309735000msat",
          "msatoshi_total": 309735000,
          "total_msat": "309735000msat",
          "dust_limit_satoshis": 546,
          "dust_limit_msat": "546000msat",
          "max_htlc_value_in_flight_msat": 18446744073709552000,
          "max_total_htlc_in_msat": "18446744073709551615msat",
          "their_channel_reserve_satoshis": 3098,
          "their_reserve_msat": "3098000msat",
          "our_channel_reserve_satoshis": 3097,
          "our_reserve_msat": "3097000msat",
          "spendable_msatoshi": 300877000,
          "spendable_msat": "300877000msat",
          "htlc_minimum_msat": 0,
          "minimum_htlc_in_msat": "0msat",
          "their_to_self_delay": 144,
          "our_to_self_delay": 144,
          "max_accepted_htlcs": 483,
          "status": [
            "CHANNELD_AWAITING_LOCKIN:Reconnected, and reestablished.",
            "CHANNELD_AWAITING_LOCKIN:We've confirmed funding, they haven't yet."
          ],
          "in_payments_offered": 0,
          "in_msatoshi_offered": 0,
          "in_offered_msat": "0msat",
          "in_payments_fulfilled": 0,
          "in_msatoshi_fulfilled": 0,
          "in_fulfilled_msat": "0msat",
          "out_payments_offered": 0,
          "out_msatoshi_offered": 0,
          "out_offered_msat": "0msat",
          "out_payments_fulfilled": 0,
          "out_msatoshi_fulfilled": 0,
          "out_fulfilled_msat": "0msat",
          "htlcs": []
        }
      ]
    }
  ]
}
</code></pre>

<p>It seems like, for whatever reason, other peers have failed to confirm funding.</p>

<p>And the question obviously is: how does one resolve it? :)  Any help appreciated!</p>

<p><strong>edit:</strong> Attempts to force-close channels result with this (<a href="https://gist.github.com/meeDamian/8af42ffa21fc808205e45595ffcf7ded" rel="nofollow noreferrer">full-er log</a>):</p>

<pre><code>sendrawtx exit 26, gave error code: -26?error message:?non-mandatory-script-verify-flag (Witness program hash mismatch) (code 64)?
</code></pre>

<blockquote>
  <p><strong>tl;dr:</strong> Tried opening multiple channels using a single btc tx.  Channels got stuck.  What do?</p>
</blockquote>

<lightning-network><core-lightning>
c-lightning: single tx multi-channel open stuck on CHANNELD_AWAITING_LOCKIN:We've confirmed funding, they haven't yet
meeDamian
# c-lightning: single tx multi-channel open stuck on CHANNELD_AWAITING_LOCKIN:We've confirmed funding, they haven't yet

(Asked by: username_0 on 2019-08-19)

I've tried to open multiple Lightning Network channels using a single Bitcoin transaction, with these steps:

1. For every `peer` in `PEERS` (n=25) run:

```
lightning-cli connect ${peer}
lightning-cli fundchannel_start ${peer.id} ${amount}

```

2. Save all returned `ADDRESSES`
3. Construct a Bitcoin Transaction spending `${amount}` to each of returned `${ADDRESSES}`:

```
bitcoin-cli createrawtransaction …
bitcoin-cli signrawtransactionwithkey …
bitcoin-cli sendrawtransaction …

```

4. Note returned `txid`
5. *Complete* all channels with:

```
lightning-cli fundchannel_compete ${peer.id} ${txid} ${corresponding vout}

```

6. Wait for channels to open, which never happens…

My regnet tests worked, but on mainnet things got stuck…

[Relevant transaction](https://blockstream.info/tx/1e643a835a9d1b0d2d0066bfaec516e2f8c282f8968dc74c12c2e430c8be9721?expand).

[(Redacted) output](https://gist.github.com/username_0/392e9b7339aa464afcdc2217d969e00c) of `lightning-cli listpeers` for involved peers.

Among all of the channels that got stuck, there's one where both ends are under my control (`c-lightning <----> lnd`). I'm able to test things on it:

```
$ lightning-cli listpeers 03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74 | jq
{
  "peers": [
    {
      "id": "03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74",
      "connected": true,
      "netaddr": [
        "203.150.177.97:52226"
      ],
      "globalfeatures": "",
      "localfeatures": "81",
      "channels": [
        {
          "state": "CHANNELD_AWAITING_LOCKIN",
          "scratch_txid": "873bbef47e5c6dda481d62cf5b67d83170448a81e770162aedf1437d6ce16ef9",
          "owner": "lightning_channeld",
          "short_channel_id": "589813x1972x24",
          "direction": 0,
          "channel_id": "2197bec830e4c2124cc78d96f882c2f8e216c5aebf66002d0d1b9d5a833a6406",
          "funding_txid": "1e643a835a9d1b0d2d0066bfaec516e2f8c282f8968dc74c12c2e430c8be9721",
          "private": false,
          "funding_allocation_msat": {
            "03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74": 0,
            "032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e": 309735000
          },
          "funding_msat": {
            "03935a378993d0b55056801b11957aaecb9f85f34b64245f864c22a2d25001de74": "0msat",
            "032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e": "309735000msat"
          },
          "msatoshi_to_us": 309735000,
          "to_us_msat": "309735000msat",
          "msatoshi_to_us_min": 309735000,
          "min_to_us_msat": "309735000msat",
          "msatoshi_to_us_max": 309735000,
          "max_to_us_msat": "309735000msat",
          "msatoshi_total": 309735000,
          "total_msat": "309735000msat",
          "dust_limit_satoshis": 546,
          "dust_limit_msat": "546000msat",
          "max_htlc_value_in_flight_msat": 18446744073709552000,
          "max_total_htlc_in_msat": "18446744073709551615msat",
          "their_channel_reserve_satoshis": 3098,
          "their_reserve_msat": "3098000msat",
          "our_channel_reserve_satoshis": 3097,
          "our_reserve_msat": "3097000msat",
          "spendable_msatoshi": 300877000,
          "spendable_msat": "300877000msat",
          "htlc_minimum_msat": 0,
          "minimum_htlc_in_msat": "0msat",
          "their_to_self_delay": 144,
          "our_to_self_delay": 144,
          "max_accepted_htlcs": 483,
          "status": [
            "CHANNELD_AWAITING_LOCKIN:Reconnected, and reestablished.",
            "CHANNELD_AWAITING_LOCKIN:We've confirmed funding, they haven't yet."
          ],
          "in_payments_offered": 0,
          "in_msatoshi_offered": 0,
          "in_offered_msat": "0msat",
          "in_payments_fulfilled": 0,
          "in_msatoshi_fulfilled": 0,
          "in_fulfilled_msat": "0msat",
          "out_payments_offered": 0,
          "out_msatoshi_offered": 0,
          "out_offered_msat": "0msat",
          "out_payments_fulfilled": 0,
          "out_msatoshi_fulfilled": 0,
          "out_fulfilled_msat": "0msat",
          "htlcs": []
        }
      ]
    }
  ]
}

```

It seems like, for whatever reason, other peers have failed to confirm funding.

And the question obviously is: how does one resolve it? :) Any help appreciated!

**edit:** Attempts to force-close channels result with this ([full-er log](https://gist.github.com/username_0/8af42ffa21fc808205e45595ffcf7ded)):

```
sendrawtx exit 26, gave error code: -26?error message:?non-mandatory-script-verify-flag (Witness program hash mismatch) (code 64)?

```

> **tl;dr:** Tried opening multiple channels using a single btc tx. Channels got stuck. What do?

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


---

## 1 answers

### Answer by username_1 on 2019-08-20. Score: 1 | Accepted answer

I wrote the `fundchannel_start`/`fundchannel_complete` pathway. You **should not broadcast the signed funding transaction until after you have successfully called `fundchannel_complete` for each of the peers**. This is because `fundchannel_complete` secures the commitment transactions that are necessary to spend the funding transaction output for that channel. By broadcasting the transaction before you've 'completed' the channel open, there's no guarantee that you'll be able to spend those funds.

If you get an error in any of the `funchannel_complete`s then your entire funding transaction will have to be discarded/cancelled. There's not good support at the moment for calling `fundchannel_cancel` after `fundchannel_complete` has been called; this needs to be fixed. There's an open issue for it on c-lightning's Github repo.

It's highly likely that the issue you're seeing with the LND/c-lightning interop is related to the fact that you published the funding transaction before notifying them about it. You might try re-scanning the blockchain with the LND node and see if it resolves the error.

> **Comments:**
> **username_0**: I definitely misunderstood it then, and run `fundchannel_complete` **after** sending the transaction :/. Rescanning helped c-lightning, but no such luck with lnd unfortunately (The only relevant rescan I've found with them was: https://github.com/lightningnetwork/lnd/blob/master/docs/recovery.md#forced-in-place-rescan)  
> **username_0**: On a side note: perhaps `fundchannel_[pre]confirm`, or `fundchannel_ensure` would be a better name for it.  
> **username_0**: Also @username_1, funds lost, or might be possible to recover?  

---

