Skip to content

[bug]: In Ver lightning-terminal:v0.13.99-alpha.rc4 #1019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lukegao209 opened this issue Jul 13, 2024 · 25 comments · Fixed by #1030 or #1033
Closed

[bug]: In Ver lightning-terminal:v0.13.99-alpha.rc4 #1019

lukegao209 opened this issue Jul 13, 2024 · 25 comments · Fixed by #1030 or #1033
Assignees
Labels
bug Something isn't working needs triage
Milestone

Comments

@lukegao209
Copy link
Contributor

lukegao209 commented Jul 13, 2024

Background

I understand that you guys might be working on bugs in this version, but I wanted to share the issues I’ve encountered in case it helps.

•	Version: lightning-terminal:v0.13.99-alpha.rc4
•	Litds: Alice and Bob
•	Network: Regtest
•	Bitcoin Node: Bitcoind (mint 1 block/min), BlockHeight: 10000+

Issues:

  • Long Sync Time: After the initial startup, Litd takes a long time to sync before it becomes usable, at least 30 minutes. This seems excessively long.
2024-07-13 10:21:11 2024-07-13 02:21:11.691 [INF] LTND: Waiting for wallet encryption password. Use `lncli create` to create a wallet, `lncli unlock` to unlock an existing wallet, or `lncli changepassword` to change the password of an existing wallet and unlock it.
2024-07-13 10:21:45 2024-07-13 02:21:45.611 [INF] LNWL: Opened wallet
2024-07-13 10:21:45 2024-07-13 02:21:45.612 [INF] LTND: Wallet recovery mode enabled with address lookahead of 12345678 addresses
2024-07-13 10:21:45 2024-07-13 02:21:45.640 [INF] LITD: Connecting basic lnd client
2024-07-13 10:21:45 2024-07-13 02:21:45.641 [INF] LITD: Basic lnd client connected
2024-07-13 10:21:45 2024-07-13 02:21:45.641 [INF] LITD: Connecting full lnd client
2024-07-13 10:21:45 2024-07-13 02:21:45.641 [INF] LNDC: Creating lnd connection to 127.0.0.1:10009
2024-07-13 10:21:45 2024-07-13 02:21:45.642 [INF] LNDC: Connected to lnd
2024-07-13 10:21:45 2024-07-13 02:21:45.643 [INF] LNDC: Waiting for lnd to unlock
2024-07-13 10:21:45 2024-07-13 02:21:45.643 [INF] LNDC: Wallet state of lnd is now: Wallet is unlocked
2024-07-13 10:21:46 2024-07-13 02:21:46.702 [INF] LNWL: Started listening for bitcoind block notifications via ZMQ on 54.92.19.81:28334
2024-07-13 10:21:46 2024-07-13 02:21:46.702 [INF] LNWL: Started listening for bitcoind transaction notifications via ZMQ on 54.92.19.81:28335
2024-07-13 10:21:48 2024-07-13 02:21:48.047 [INF] LNWL: The wallet has been unlocked without a time limit
2024-07-13 10:21:48 2024-07-13 02:21:48.344 [INF] CHRE: LightningWallet opened
2024-07-13 10:21:48 2024-07-13 02:21:48.344 [INF] LNWL: RECOVERY MODE ENABLED -- rescanning for used addresses with recovery_window=12345678
2024-07-13 10:21:48 2024-07-13 02:21:48.502 [INF] HSWC: Cleaning circuits from disk for closed channels
2024-07-13 10:21:48 2024-07-13 02:21:48.502 [INF] HSWC: Finished cleaning: no closed channels found, no actions taken.
2024-07-13 10:21:48 2024-07-13 02:21:48.503 [INF] HSWC: Restoring in-memory circuit state from disk
2024-07-13 10:21:48 2024-07-13 02:21:48.504 [INF] HSWC: Payment circuits loaded: num_pending=2, num_open=0
2024-07-13 10:21:48 2024-07-13 02:21:48.506 [INF] HSWC: Trimming open circuits for chan_id=9059:1:0, start_htlc_id=15
2024-07-13 10:21:48 2024-07-13 02:21:48.506 [INF] HSWC: Trimming open circuits for chan_id=9141:1:0, start_htlc_id=4
2024-07-13 10:21:48 2024-07-13 02:21:48.511 [INF] LTND: Channel backup proxy channel notifier starting
2024-07-13 10:21:48 2024-07-13 02:21:48.511 [INF] ATPL: Instantiating autopilot with active=false, max_channels=5, allocation=0.600000, min_chan_size=20000, max_chan_size=16777215, private=false, min_confs=1, conf_target=3
2024-07-13 10:21:48 2024-07-13 02:21:48.514 [INF] LTND: We're not running within systemd or the service type is not 'notify'
2024-07-13 10:21:48 2024-07-13 02:21:48.514 [INF] LNDC: Wallet state of lnd is now: Lnd RPC server is ready for requests
2024-07-13 10:21:48 2024-07-13 02:21:48.795 [INF] LTND: Waiting for chain backend to finish sync, start_height=11578
2024-07-13 10:21:49 2024-07-13 02:21:49.535 [INF] LNWL: Seed birthday surpassed, starting recovery of wallet from height=11531 hash=7b07aa16e25cbfbc62a8fcabccd2da1620f2665a1a8dd6d83ea87deb7f6138ed with recovery-window=12345678
2024-07-13 10:21:49 2024-07-13 02:21:49.831 [INF] LNDC: lnd version: v0.18.0-beta, build tags 'litd,autopilotrpc,signrpc,walletrpc,chainrpc,invoicesrpc,watchtowerrpc,neutrinorpc,peersrpc'
2024-07-13 10:21:49 2024-07-13 02:21:49.832 [INF] LNDC: Using network regtest
2024-07-13 10:21:49 2024-07-13 02:21:49.832 [INF] LNDC: Waiting for lnd to be fully synced to its chain backend, this might take a while
2024-07-13 10:22:09 2024-07-13 02:22:09.806 [INF] LNWL: Scanning 48 blocks for recoverable addresses
  • Pending Channel: When creating a channel, if there are insufficient BTC UTXOs or asset UTXOs, a channel remains pending indefinitely.
/ # lncli -n regtest pendingchannels
{
    "total_limbo_balance": "0",
    "pending_open_channels": [
        {
            "channel": {
                "remote_node_pub": "0275af3b2eedf99d863ea22f92bfeb6687b4ece1f620705143c42e4ca6e40eaf8e",
                "channel_point": "4fbbe4dd3f32ef7f48945db835c203786281db8a2cdbda5e96457df9f4eb7223:0",
                "capacity": "100000",
                "local_balance": "96920",
                "remote_balance": "0",
                "local_chan_reserve_sat": "1000",
                "remote_chan_reserve_sat": "1062",
                "initiator": "INITIATOR_LOCAL",
                "commitment_type": "SIMPLE_TAPROOT",
                "num_forwarding_packages": "0",
                "chan_status_flags": "",
                "private": true,
                "memo": "",
                "custom_channel_data": {
                    "assets": [
                        {
                            "asset_utxo": {
                                "version": 1,
                                "asset_genesis": {
                                    "genesis_point": "7138faef3ebe1e7d9f4ff85f2f4a381f5ee0b82de2a36f4ac033b062924267b5:0",
                                    "name": "TREAT",
                                    "meta_hash": "0000000000000000000000000000000000000000000000000000000000000000",
                                    "asset_id": "00f74dc1ff611b46176fa316b1c10d7214602544e085dc883d02534e74999657"
                                },
                                "amount": 1500,
                                "script_key": "0250aaeb166f4234650d84a2d8a130987aeaf6950206e0905401ee74ff3f8d18e6"
                            },
                            "capacity": 1500,
                            "local_balance": 1500,
                            "remote_balance": 0
                        }
                    ]
                }
            },
            "commit_fee": "2420",
            "commit_weight": "614",
            "fee_per_kw": "2500",
            "funding_expiry_blocks": -505
        }
    ],
    "pending_closing_channels": [],
    "pending_force_closing_channels": [],
    "waiting_close_channels": []
}
  • Crash on Transfer: When Alice and Bob create a Taproot channel for USDT assets, and Alice transfers all her local USDT to Bob, Alice’s Litd crashes.
@Roasbeef
Copy link
Member

Long Sync Time: After the initial startup, Litd takes a long time to sync before it becomes usable, at least 30 minutes. This seems excessively long.
2024-07-13 10:21:48 2024-07-13 02:21:48.344 [INF] LNWL: RECOVERY MODE ENABLED -- rescanning for used addresses with recovery_window=12345678

You have recovery mode activated in your config, which means it will always do a rescan from the wallet birthday. If you don't want to rescan each time the daemon starts up (can take time depending on how old the wallet is), then you can safely remove that config.

@dstadulis dstadulis moved this from 🆕 New to 💇‍♂️Needs Shaping in Taproot-Assets Project Board Jul 14, 2024
@dstadulis dstadulis added this to the v0.4.1 milestone Jul 14, 2024
@guggero
Copy link
Member

guggero commented Jul 15, 2024

Thanks for the issue report! I agree with what @Roasbeef set above, if you see RECOVERY MODE ENABLED you're probably doing something wrong (sounds like you're specifying recovery_window as non-zero when unlocking the wallet?).

I'll look into removing the pending channels if it isn't funded properly.

For the crash, do you happen to have the logs still? How did you initiate the transfer? Through an invoice or with a keysend payment?

@lukegao209
Copy link
Contributor Author

About Crash , here is my cmd(I could't get the logs as the docker container crashed) :
litcli -n regtest --rpcserver=localhost:8443 --macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon ln sendpayment --keysend=true --asset_id=ecdd152658201c9f43593a8ff37bb38c0f1c0355bfa8376a3638f8f06dcc1168 --dest=03cf55abd48285d1b3a6cfb03184212fa561c55aba5eebf378ddb4bbcdc9f7c7fd --amt=1500

@lukegao209
Copy link
Contributor Author

I’ll look into removing the pending channels if they aren’t funded properly. I called the fundChannel method twice:

  1. The first attempt failed due to having enough Taproot assets UTXO but no BTC-level UTXO.
  2. In the second attempt, I added BTC to the node, resulting in enough BTC-level UTXO but no Taproot assets UTXO (likely because the UTXO was pending from step 1).

As a result, there has been a pending channel ever since.

@lukegao209
Copy link
Contributor Author

" I agree with what @Roasbeef set above, if you see RECOVERY MODE ENABLED you're probably doing something wrong (sounds like you're specifying recovery_window as non-zero when unlocking the wallet?)."
I haven't set any setting about RECOVERY MODE .
here is my docker-compose file :

name: ${LIT_NAME}-${LIT_NETWORK}
services:
  lit:
    image: lightninglabs/lightning-terminal:v0.13.99-alpha.rc4
    container_name: ${LIT_NAME}-${LIT_NETWORK}
    volumes:
      - ${LIT_DATA_PATH}/lit:/root/.lit
      - ${LIT_DATA_PATH}/lnd:/root/.lnd
      - ${LIT_DATA_PATH}/loop:/root/.loop
      - ${LIT_DATA_PATH}/tapd:/root/.tapd
      - ${TOR_PATH}:/root/.tor
    expose:
      - "8443"
      - "8442"
      - "10009"
      - "10010"
    ports:
      - "${LIT_PORT_HTTPS}:8443"
      - "${LIT_PORT_INSECURE_HTTPS}:8442"
      - "${LIT_PORT_LND}:10009"
    command:
      - "lightning-terminal"
      - "--httpslisten=0.0.0.0:8443"
      - "--insecure-httplisten=0.0.0.0:8442"
      - "--uipassword=${LIT_UI_PASSWORD}"
      - "--network=${LIT_NETWORK}"
      - "--tlsextradomain=${LIT_TLSEXTRADOMAIN}"
      - "--tlsextradomain=${LND_TLSEXTRADOMAIN}"
      - "--tlsextradomain=${TAPD_TLSEXTRADOMAIN}"
      - "--tlsextraip=${LIT_TLSEXTRAIP}"
      - "--tlsextraip=127.0.0.1"

      - "--lnd-mode=integrated"
      - "--lnd.bitcoin.active"
      - "--lnd.bitcoin.node=bitcoind"
      - "--lnd.alias=${LND_ALIAS}"
      - "--lnd.tlsextradomain=${LIT_TLSEXTRADOMAIN}"
      - "--lnd.tlsextradomain=${LND_TLSEXTRADOMAIN}"
      - "--lnd.tlsextradomain=${TAPD_TLSEXTRADOMAIN}"
      - "--lnd.tlsextradomain=localhost"
      - "--lnd.tlsextraip=${LIT_TLSEXTRAIP}"
      - "--lnd.tlsextraip=127.0.0.1"
      - "--lnd.externalip=${LND_EXTERNALIP}"
      - "--lnd.rpclisten=0.0.0.0:10009"
      - "--lnd.listen=0.0.0.0:9735"
      - "--lnd.debuglevel=info"
      - "--lnd.rpcmiddleware.enable"
      - "--lnd.protocol.wumbo-channels"
      - "--lnd.maxpendingchannels=10"
      - "--lnd.protocol.option-scid-alias"
      - "--lnd.protocol.zero-conf"
      - "--lnd.protocol.simple-taproot-chans"
      - "--lnd.protocol.simple-taproot-overlay-chans"
      - "--lnd.protocol.custom-message=17"
      - "--lnd.accept-keysend"

      - "--lnd.bitcoind.rpchost=${BITCOIND_RPCHOST}"
      - "--lnd.bitcoind.rpcuser=${BITCOIND_RPCUSER}"
      - "--lnd.bitcoind.rpcpass=${BITCOIND_RPCPASS}"
      - "--lnd.bitcoind.zmqpubrawblock=${BITCOIND_ZMQBLOCK}"
      - "--lnd.bitcoind.zmqpubrawtx=${BITCOIND_ZMQRAWTX}"

      # - "--lnd.tor.active"
      # - "--lnd.tor.v3"
      # - "--lnd.tor.skip-proxy-for-clearnet-targets"
      # - "--lnd.tor.dns=nodes.lightning.directory"
      # - "--lnd.tor.socks=${TOR_SOCKS}"
      # - "--lnd.tor.control=${TOR_CONTROL}"
      
      - "--autopilot.disable"

      - "--taproot-assets-mode=integrated"
      - "--taproot-assets.rpclisten=0.0.0.0:10029"
      - "--taproot-assets.restlisten=0.0.0.0:8089"
      - "--taproot-assets.tlsextradomain=${TAPD_TLSEXTRADOMAIN}"
      - "--taproot-assets.tlsextraip=${TAPD_TLSEXTRAIP}"
      - "--taproot-assets.tlsextraip=127.0.0.1"
      - "--taproot-assets.universe.public-access=rw"
      - "--taproot-assets.allow-public-uni-proof-courier"
      - "--taproot-assets.allow-public-stats"
      - "--taproot-assets.experimental.rfq.priceoracleaddress=use_mock_price_oracle_service_promise_to_not_use_on_mainnet"
      - "--taproot-assets.experimental.rfq.skipacceptquotepricecheck"
      - "--taproot-assets.experimental.rfq.mockoraclesatsperasset=10"
      # - "--taproot-assets.tapddir=/root/.lit/tapd"
      # - "--taproot-assets.tlskeypath=/root/.lit/tls.key"
      # - "--taproot-assets.tlscertpath=/root/.lit/tls.cert"

      - "--faraday-mode=disable"
      - "--faraday.min_monitored=24h"
      - "--faraday.connect_bitcoin"
      - "--faraday.bitcoin.host=${BITCOIND_RPCHOST}"
      - "--faraday.bitcoin.user=${BITCOIND_RPCUSER}"
      - "--faraday.bitcoin.password=${BITCOIND_RPCPASS}"
      - "--faraday.debuglevel=info"
      
      - "--loop-mode=disable"
      - "--loop.network=${LIT_NETWORK}"
      - "--loop.tlsautorefresh"
      - "--loop.server.host=${LOOP_SERVER}"
      - "--loop.server.notls"
      
      - "--pool-mode=disable"
    networks:
      - lnfi_network
    logging:
      driver: "json-file"
      options:
        max-file: "3"   # number of files or file count
        max-size: "50m" # file size
networks:
  lnfi_network:
    external: true

@lukegao209
Copy link
Contributor Author

Thanks for the issue report! I agree with what @Roasbeef set above, if you see RECOVERY MODE ENABLED you're probably doing something wrong (sounds like you're specifying recovery_window as non-zero when unlocking the wallet?).

I'll look into removing the pending channels if it isn't funded properly.

For the crash, do you happen to have the logs still? How did you initiate the transfer? Through an invoice or with a keysend payment?

@guggero Thank you for your response. Here is some additional information regarding the three issues mentioned above

@guggero
Copy link
Member

guggero commented Jul 15, 2024

See my comment above regarding recovery mode:

(sounds like you're specifying recovery_window as non-zero when unlocking the wallet?

@guggero
Copy link
Member

guggero commented Jul 15, 2024

Was able to reproduce the crash due to sending the full balance, thanks for the additional info.

@lukegao209
Copy link
Contributor Author

See my comment above regarding recovery mode:

(sounds like you're specifying recovery_window as non-zero when unlocking the wallet?

I haven't specified recovery_window when unlocking the wallet.

@guggero
Copy link
Member

guggero commented Jul 15, 2024

So where does this value come from then? Looks like something from an example script that was copied by accident: recovery-window=12345678

@guggero
Copy link
Member

guggero commented Jul 15, 2024

Are you using some sort of startup script that creates or unlocks the wallet?

@lukegao209
Copy link
Contributor Author

lukegao209 commented Jul 15, 2024

So where does this value come from then? Looks like something from an example script that was copied by accident: recovery-window=12345678
"Are you using some sort of startup script that creates or unlocks the wallet?" ==> no

[Edited whitespace]
I don't know why its 12345678.
unlock cmd just : lncli -n regtest unlock

@lukegao209
Copy link
Contributor Author

So where does this value come from then? Looks like something from an example script that was copied by accident: recovery-window=12345678
"Are you using some sort of startup script that creates or unlocks the wallet?" ==> no
I don't know why its 12345678.
unlock cmd just : lncli -n regtest unlock

The bitcoind was only 10,000+ blocks and had few transactions, yet the sync took over an hour. Is this normal, or does it seem to be taking too much time?

@guggero
Copy link
Member

guggero commented Jul 15, 2024

Did you perhaps at one point compile lncli with some hard coded value? I have no idea where the value 12345678 comes from. But it's causing the recovery mode.

The other thing to consider on regtest is that if the last block is more than 2 hours old, lnd will assume it is not synced with the network. So it's possible your network was out of date when you started litd, that's why the wallet waited for a new block to come in. And then after an hour, you mined another block, which then made lnd continue.

@guggero
Copy link
Member

guggero commented Jul 15, 2024

@lukegao209 I just tried creating a channel with insufficient BTC balance and got the following:

[litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to fund PSBT: unable to fund psbt: rpc error: code = Unknown desc = error selecting coins: not enough witness outputs to create funding transaction, need 0.00100000 BTC only have 0.00010000 BTC available

And then I also tried with not enough asset balance and got this error:

[litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to fund vPacket: unable to select coins: failed to find coin(s) that satisfy given constraints; if previous transfers are un-confirmed, wait for them to confirm before trying again

So I don't see how you could've gotten into that state.
Could you perhaps try to reproduce and send us the full logs? Ideally running with --lnd.debuglevel=trace,SRVR=debug,PEER=info,BTCN=warn,GRPC=error on both the sender and receiver side.

I could't get the logs as the docker container crashed

I think docker should allow you to get the logs of a shutdown container still.
Otherwise the log files are normally written to ~/.lnd/logs/bitcoin/regtest/lnd.log within the container. So if you can mount that to a directory on your host, it should be easy to access them.
Without logs we're flying blind so you save us both a lot of time if you can supply them. Thanks in advance!

@lukegao209
Copy link
Contributor Author

@lukegao209 I just tried creating a channel with insufficient BTC balance and got the following:

[litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to fund PSBT: unable to fund psbt: rpc error: code = Unknown desc = error selecting coins: not enough witness outputs to create funding transaction, need 0.00100000 BTC only have 0.00010000 BTC available

And then I also tried with not enough asset balance and got this error:

[litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to fund vPacket: unable to select coins: failed to find coin(s) that satisfy given constraints; if previous transfers are un-confirmed, wait for them to confirm before trying again

So I don't see how you could've gotten into that state. Could you perhaps try to reproduce and send us the full logs? Ideally running with --lnd.debuglevel=trace,SRVR=debug,PEER=info,BTCN=warn,GRPC=error on both the sender and receiver side.

I could't get the logs as the docker container crashed

I think docker should allow you to get the logs of a shutdown container still. Otherwise the log files are normally written to ~/.lnd/logs/bitcoin/regtest/lnd.log within the container. So if you can mount that to a directory on your host, it should be easy to access them. Without logs we're flying blind so you save us both a lot of time if you can supply them. Thanks in advance!

I can’t reproduce this issue now. At that time, I had just created two litd instances for Alice and Bob, and then started fundChannel, which led to the issue. I will try more later

@jamaljsr
Copy link
Member

I think I was able to repro the pending channel issue with the following steps:

  1. Start a new regtest litd v0.13.99-alpha.rc4 node
  2. Deposit 50K sats to the node
  3. Mint 1000 PBUX assets. This left me with 40,763 sats
  4. Try to fund a 400 PBUX channel results in the expected error
    litd@alice:/$ litcli --macaroonpath ~/.lnd/data/chain/bitcoin/regtest/admin.macaroon ln fundchannel --asset_id 634b96ec03b0cce213c8d8d22719f439ee5df0aba5ea0bcd8cf7a511f060a36a --node_key 031a212e2f751582dbd3237b480a7b72e9f7cf8cf63ee08ce2646f974733482a07 --sat_per_vbyte 10 --asset_amount 400
    [litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to fund PSBT: unable to fund psbt: rpc error: code = Unknown desc = error selecting coins: not enough witness outputs to create funding transaction, need 0.00100000 BTC only have 0.00040763 BTC available
    
  5. Deposit 100K sats to the node so the new balance is 140763 sats
  6. Try to fund the channel again with the same command above
    litd@alice:/$ litcli --macaroonpath ~/.lnd/data/chain/bitcoin/regtest/admin.macaroon ln fundchannel --asset_id 634b96ec03b0cce213c8d8d22719f439ee5df0aba5ea0bcd8cf7a511f060a36a --node_key 031a212e2f751582dbd3237b480a7b72e9f7cf8cf63ee08ce2646f974733482a07 --sat_per_vbyte 10 --asset_amount 400
    [litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to open channel: rpc error: code = Unknown desc = remote canceled funding, possibly timed out: received funding error from 031a212e2f751582dbd3237b480a7b72e9f7cf8cf63ee08ce2646f974733482a07: chan_id=06d84ba388b8985adb9e0697480bd5dad7691c980ac3c14ea955db144ce51e93, err=Number of pending channels exceed maximum
    
  7. Retrying to fund the channel will continue to return the above error, but if I restart the node then the pending channel goes away and I can fund a new channel successfully. This seems like a reasonable enough workaround unless there's a cleaner way to remove the pending pending channel.

Here's the full log for this node.
alice.log

@lukegao209
Copy link
Contributor Author

not enough witness outputs to create funding transaction
I saw this error when the issue happened on my mac. @guggero

@guggero
Copy link
Member

guggero commented Jul 17, 2024

I think I was able to repro the pending channel issue with the following steps:

1. Start a new regtest `litd` v0.13.99-alpha.rc4 node

2. Deposit 50K sats to the node

3. Mint 1000 PBUX assets. This left me with 40,763 sats

4. Try to fund a 400 PBUX channel results in the expected error
   ```
   litd@alice:/$ litcli --macaroonpath ~/.lnd/data/chain/bitcoin/regtest/admin.macaroon ln fundchannel --asset_id 634b96ec03b0cce213c8d8d22719f439ee5df0aba5ea0bcd8cf7a511f060a36a --node_key 031a212e2f751582dbd3237b480a7b72e9f7cf8cf63ee08ce2646f974733482a07 --sat_per_vbyte 10 --asset_amount 400
   [litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to fund PSBT: unable to fund psbt: rpc error: code = Unknown desc = error selecting coins: not enough witness outputs to create funding transaction, need 0.00100000 BTC only have 0.00040763 BTC available
   ```

5. Deposit 100K sats to the node so the new balance is 140763 sats

6. Try to fund the channel again with the same command above
   ```
   litd@alice:/$ litcli --macaroonpath ~/.lnd/data/chain/bitcoin/regtest/admin.macaroon ln fundchannel --asset_id 634b96ec03b0cce213c8d8d22719f439ee5df0aba5ea0bcd8cf7a511f060a36a --node_key 031a212e2f751582dbd3237b480a7b72e9f7cf8cf63ee08ce2646f974733482a07 --sat_per_vbyte 10 --asset_amount 400
   [litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: unable to open channel: rpc error: code = Unknown desc = remote canceled funding, possibly timed out: received funding error from 031a212e2f751582dbd3237b480a7b72e9f7cf8cf63ee08ce2646f974733482a07: chan_id=06d84ba388b8985adb9e0697480bd5dad7691c980ac3c14ea955db144ce51e93, err=Number of pending channels exceed maximum
   ```

7. Retrying to fund the channel will continue to return the above error, but if I restart the node then the pending channel goes away and I can fund a new channel successfully. This seems like a reasonable enough workaround unless there's a cleaner way to remove the pending pending channel.

Here's the full log for this node. alice.log

Thanks a lot for the reproduction @jamaljsr!
I was able to fix this with #1030 and lightninglabs/lightning-terminal#797. The symptoms reported by you are slightly different from those reported by @lukegao209, but I think the root cause might have been the same.

So this issue should be fully closed by #1030.

@jamaljsr
Copy link
Member

jamaljsr commented Jul 18, 2024

@guggero I tested #1030 today, repeating the same steps above and received the following errors.

# deposit 50K sats and mint 1000 PBUX

litd@alice:/$ litcli --macaroonpath ~/.lnd/data/chain/bitcoin/regtest/admin.macaroon ln fundchannel --asset_id b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412 --node_key 029d0464da60cacf11e4aa1e51cf5abcbb373b9c638a24e4fe3b215625a2c25e35 --sat_per_vbyte 10 --asset_amount 400
[litcli] error funding channel: rpc error: code = Unknown desc = error funding channel: didn't receive funding ack after 30s

# deposit 100K sats

litd@alice:/$ litcli --macaroonpath ~/.lnd/data/chain/bitcoin/regtest/admin.macaroon ln fundchannel --asset_id b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412 --node_key 029d0464da60cacf11e4aa1e51cf5abcbb373b9c638a24e4fe3b215625a2c25e35 --sat_per_vbyte 10 --asset_amount 400
[litcli] asset with ID b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412 not found or no UTXO with at least amount 400 is available

itd@alice:/$ tapcli assets list
{
    "assets": [],
    "unconfirmed_transfers": "0",
    "unconfirmed_mints": "0"
}

litd@alice:/$ tapcli assets balance
{
    "asset_balances": {
        "b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412": {
            "asset_genesis": {
                "genesis_point": "6952c614ad03fc6868e18114163890906be9422ed702af50cab6aac7df9ea2e3:1",
                "name": "PBUX",
                "meta_hash": "0000000000000000000000000000000000000000000000000000000000000000",
                "asset_id": "b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412",
                "asset_type": "NORMAL",
                "output_index": 0
            },
            "balance": "1000"
        }
    },
    "asset_group_balances": {}
}

litd@alice:/$ lncli pendingchannels
{
    "total_limbo_balance": "0",
    "pending_open_channels": [],
    "pending_closing_channels": [],
    "pending_force_closing_channels": [],
    "waiting_close_channels": []
}

It seems like the asset went missing after the first channel funding failed.

Here are the logs for both nodes.
alice.log
bob.log

@Roasbeef
Copy link
Member

Roasbeef commented Jul 18, 2024

@jamaljsr did the branch you were testing on include this PR: #1029?

That has a bug fix to properly unlock the asset if something goes wrong during funding.

EDIT: yeah one side fails as it can't fetch the proof, see blow

@Roasbeef
Copy link
Member

Roasbeef commented Jul 18, 2024

Looking at the logs, the first funding attempt failed as Bob wasn't able to verify that the asset actually existed:

2024-07-18 19:44:59.998 [DBG] ADDR: asset b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412 is unknown, attempting to bootstrap
2024-07-18 19:44:59.998 [INF] UNIV: Synced new Universe leaves for asset b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412, diff_size=0
2024-07-18 19:44:59.999 [ERR] TSVR: Error in funding flow for pending chan ID cc1347fa1b0df4a9793e6d0e19c175f2e695f03e2e529e53f6d0083774f1d2a3: unable to verify genesis proof for asset_id=b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412: asset lookup failed for asset: b80301843d0874075c5478e7a0decfe8b67e7022df6022fe485e6ed306149412

Was the new asset uploaded to the Universe before the fund call as executed?

Also I only see one funding attempt in the logs oddly.

@jamaljsr
Copy link
Member

jamaljsr commented Jul 18, 2024

@jamaljsr did the branch you were testing on include this PR: #1029?

I am using the initiator-zero-balance-coop-close branch of lightninglabs/lightning-terminal#797 which looks like it includes #1029.

Was the new asset uploaded to the Universe before the fund call as executed?

In Polar, every node is a universe server. I only have them syncing assets when generating a receive address. In prior testing with RC4, I never needed to sync the asset to the channel recipient before funding. Is this going to be required going forward? It looks like funding channels when the node has enough BTC fails as well with this change.

@Roasbeef
Copy link
Member

I only have them syncing assets when generating a receive address. In prior testing with RC4, I never needed to sync the asset to the channel recipient before funding. Is this going to be required going forward? It looks like funding channels when the node has enough BTC fails as well with this change.

Hmm, so the way we have it right now, when you go to generate an address, if you don't yet know of that asset, then it'll try to fetch it from the connected universe. In the logs it tries to sync from the configured remote universe server. Looking a bit deeper, looks like none are configured:

2024-07-18 19:43:48.941 [WRN] UNIV: could not find any federation servers

@github-project-automation github-project-automation bot moved this from 💇‍♂️Needs Shaping to ✅ Done in Taproot-Assets Project Board Jul 18, 2024
@Roasbeef
Copy link
Member

Re-opening as we want to make sure the asset unlock issue is fully resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
Status: ✅ Done
5 participants