Skip to content
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

[bug]: Asset Channel Payment Fails with "FAILURE_REASON_NO_ROUTE" #1378

Closed
shuishihang opened this issue Feb 12, 2025 · 29 comments
Closed

[bug]: Asset Channel Payment Fails with "FAILURE_REASON_NO_ROUTE" #1378

shuishihang opened this issue Feb 12, 2025 · 29 comments
Labels
bug Something isn't working needs triage

Comments

@shuishihang
Copy link

I created four litd nodes named A, B, C, and D, and all of them hold the same asset. I established asset channels between A and B, between B and C, and between C and D using the same asset. Now, I generated an asset invoice on node D and attempted to pay it from node A, but the payment failed with the error: "Payment failed: FAILURE_REASON_NO_ROUTE"

@guggero
Copy link
Member

guggero commented Feb 12, 2025

The issue is that all asset channels are a sub type of Taproot channels. And because those look differently on chain than previous channel types, we need an update to the specification for those to be announced to the network.
The consequence of that is that currently all asset channels are private. So A and B in your scenario don't know about the channel between C and D. And A doesn't know about the channel between B and C.
If you have an invoice, that invoice will contain a so-called route hint for the last edge. So A would learn about the channel CD from the invoice, but it would still not know about channel BC.

Since the idea is that asset channels are only used "at the edge of the network", that would mean that the "core" of the network would be made up of normal, non-asset public channels. So in your scenario, the channel between B and C should be a normal, BTC-only public channel (of the anchors type, not taproot so it can be announced to the network) so all other nodes can learn about it and use it for routing.

Then B and C would be so-called "edge nodes" that convert from/to assets for their end-user nodes A and D.

@shuishihang
Copy link
Author

Thank you, I understand now, but why was A able to successfully pay when I created an asset invoice using C?

@guggero
Copy link
Member

guggero commented Feb 12, 2025

Because A knows about the channel AB and the invoice contains a "route hint" for the channel BC, which completes the route. But if you try to pay D, then the invoice route hint only contains CD and A is missing the information for the channel BC (it won't remember those channels that were previously in invoices).

Closing the issue as "won't fix" as asset channels at the edge will likely remain private even in the future. But feel free to comment further if you have more questions.

@guggero guggero closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2025
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Taproot-Assets Project Board Feb 12, 2025
@shuishihang
Copy link
Author

Thank you very much, I think I have a general understanding now.

@shuishihang
Copy link
Author

I encountered an issue with the asset channel. Every time Alice makes a payment to Bob, it always carries 354 satoshis. Is it possible to configure this amount to be reduced further?

@guggero
Copy link
Member

guggero commented Feb 12, 2025

No, that's the minimum amount to be above the dust limit. See #888.
There will be a workaround in the future, but that will take some time: lightningnetwork/lnd#9430

So currently that's by design until a more custom solution is implemented.

@shuishihang
Copy link
Author

Why does this error occur?
rpc error: code = Unknown desc = error funding channel: unable to fund PSBT: unableto fund psbt: rpc error: code = Unknown desc = error selecting coins: not enoughwitness outputs to create funding transaction,need 0.00258625 BTC only have
0.00142629 BTC available

@shuishihang
Copy link
Author

At first, the error was:
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.00079000 BTC available.

Now, the error is:
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.00258625 BTC only have 0.00142629 BTC available.

@shuishihang
Copy link
Author

Now there is another change:
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.00311500 BTC only have 0.00142629 BTC available.

@guggero
Copy link
Member

guggero commented Feb 13, 2025

Sounds like things just need to confirm? Not sure what you're doing that the number is going up.
Did you try restarting the node? What version are you on?

@shuishihang
Copy link
Author

When we open the channel and set the fee rate to 3, how much transaction fee will be charged for a normal channel opening? Do you have the transaction hash for a successfully opened channel with the fee charged? Could you provide it as a reference?

@shuishihang
Copy link
Author

I am currently testing the opening of an asset channel on the mainnet, and the issue I'm encountering is with the transaction fee. I would like to understand how much transaction fee will be charged when I set the fee rate to 3 for a normal channel opening.

@guggero
Copy link
Member

guggero commented Feb 13, 2025

It depends on how many inputs and outputs there will be, and of what type they are.
Question would be:

  • What type of address is used for funding the BTC amount? P2TR or P2WPKH?
  • Will there be a BTC change output or is the goal to fully spend the input into the channel?
  • Will there be asset change or are all assets used up for the funding?

This is an example transaction with a P2WPKH funding input and a P2TR change output and an asset change output: 8234b4861d48506095618a6fe3df9427f5a6d6083160c6f6d621a7bc785d3946
Which comes to 265 virtual bytes in size.

When you say "fee rate of 3" I assume you mean sat/vByte (Satoshi per virtual byte)?

@shuishihang
Copy link
Author

"Thank you for your help. Now I’m encountering a new error, but I’m puzzled as to why this error occurs:
rpc error: code = Unknown desc = error funding channelpeer 027208d43d94fa830417a0e730d12cd11996d5cd62df2e210cdc48464feaafd3bc does not support assetchannels.

On this node, I have already configured the following:

lnd.protocol.option-scid-alias=true
lnd.protocol.zero-conf=true
lnd.protocol.simple-taproot-chans=true
lnd.protocol.simple-taproot-overlay-chans=true
lnd.protocol.custom-message=17
lnd.accept-keysend=true
taproot-assets.proofcourieraddr=universerpc://132.232.109.84:8443
The version is "version": "0.14.0-alpha commit=v0.14.0-alpha". Why is this error occurring?"

@guggero
Copy link
Member

guggero commented Feb 13, 2025

It means the node you're connecting to (027208d43d94fa830417a0e730d12cd11996d5cd62df2e210cdc48464feaafd3bc) does not support asset channels.

@shuishihang
Copy link
Author

"Why? I have configured the settings to enable asset channels, and the version is correct. I can also find the asset channel commands in the command line. Are there any specific requirements for the configuration in the mainnet? I really can't understand why this error is occurring."

@guggero
Copy link
Member

guggero commented Feb 13, 2025

"Thank you for your help. Now I’m encountering a new error, but I’m puzzled as to why this error occurs: rpc error: code = Unknown desc = error funding channelpeer 027208d43d94fa830417a0e730d12cd11996d5cd62df2e210cdc48464feaafd3bc does not support assetchannels.

On this node, I have already configured the following:

lnd.protocol.option-scid-alias=true lnd.protocol.zero-conf=true lnd.protocol.simple-taproot-chans=true lnd.protocol.simple-taproot-overlay-chans=true lnd.protocol.custom-message=17 lnd.accept-keysend=true taproot-assets.proofcourieraddr=universerpc://132.232.109.84:8443 The version is "version": "0.14.0-alpha commit=v0.14.0-alpha". Why is this error occurring?"

So you're saying both nodes are your nodes and using this config and version? And are both running with lnd-mode=integrated (default)?
Then it should work. Can you run lncli getinfo on the receiving node and post that here please?

@shuishihang
Copy link
Author

{
"version": "0.18.5-beta commit=lightning-terminal-v0.14.1-alpha",
"commit_hash": "d56ba684068b17d877586b6fdee63c79fb88360b",
"identity_pubkey": "027208d43d94fa830417a0e730d12cd11996d5cd62df2e210cdc48464feaafd3bc",
"alias": "BTL-MAIN",
"color": "#3399ff",
"num_pending_channels": 0,
"num_active_channels": 2,
"num_inactive_channels": 0,
"num_peers": 3,
"block_height": 883661,
"block_hash": "00000000000000000000a1d64dd41e0cd0bba3d94ce36cd5bdd72077e8b428f0",
"best_header_timestamp": "1739497002",
"synced_to_chain": true,
"synced_to_graph": true,
"testnet": false,
"chains": [
{
"chain": "bitcoin",
"network": "mainnet"
}
],
"uris": [],
"features": {
"0": {
"name": "data-loss-protect",
"is_required": true,
"is_known": true
},
"5": {
"name": "upfront-shutdown-script",
"is_required": false,
"is_known": true
},
"7": {
"name": "gossip-queries",
"is_required": false,
"is_known": true
},
"8": {
"name": "tlv-onion",
"is_required": true,
"is_known": true
},
"12": {
"name": "static-remote-key",
"is_required": true,
"is_known": true
},
"14": {
"name": "payment-addr",
"is_required": true,
"is_known": true
},
"17": {
"name": "multi-path-payments",
"is_required": false,
"is_known": true
},
"23": {
"name": "anchors-zero-fee-htlc-tx",
"is_required": false,
"is_known": true
},
"25": {
"name": "route-blinding",
"is_required": false,
"is_known": true
},
"27": {
"name": "shutdown-any-segwit",
"is_required": false,
"is_known": true
},
"30": {
"name": "amp",
"is_required": true,
"is_known": true
},
"31": {
"name": "amp",
"is_required": false,
"is_known": true
},
"45": {
"name": "explicit-commitment-type",
"is_required": false,
"is_known": true
},
"47": {
"name": "scid-alias",
"is_required": false,
"is_known": true
},
"51": {
"name": "zero-conf",
"is_required": false,
"is_known": true
},
"55": {
"name": "keysend",
"is_required": false,
"is_known": true
},
"181": {
"name": "simple-taproot-chans-x",
"is_required": false,
"is_known": true
},
"2023": {
"name": "script-enforced-lease",
"is_required": false,
"is_known": true
},
"2025": {
"name": "taproot-overlay-chans",
"is_required": false,
"is_known": true
}
},
"require_htlc_interceptor": false,
"store_final_htlc_resolutions": false
}

@shuishihang
Copy link
Author

Sorry, it's my fault. The issue occurred because the channel.db file was previously replaced before opening the channel at this node.

@shuishihang
Copy link
Author

I received the following error when generating an asset channel invoice on mainnet:
[litcli] error adding invoice: rpc error: code = Unknown desc = peer 02936eb02496de2cd8dfcaea18552acb3a85672064b0799a0803ad3ff6d4269966 rejected the quote, code: 1, error message: price oracle unavailable
In my tests on a private chain, I configured:

taproot-assets.experimental.rfq.priceoracleaddress=use_mock_price_oracle_service_promise_to_not_use_on_mainnet
taproot-assets.experimental.rfq.mockoracleassetsperbtc=100000000

However, I did not configure these options on mainnet. Can I simply set them on mainnet, or do I need to set up my own price oracle? If I need to set up my own price oracle, how should I go about doing that?

@guggero
Copy link
Member

guggero commented Feb 18, 2025

You can use someone else's price oracle, for example: https://docs.ln.exchange/price-oracle
But the idea is that you run (or implement, since there aren't many implementations available yet) one yourself, using the gRPC interface described here: /~https://github.com/lightninglabs/taproot-assets/blob/51f2389169878605e49a807ba546d30b9d823876/taprpc/priceoraclerpc/price_oracle.proto
Very rudimentary example here: /~https://github.com/lightninglabs/taproot-assets/blob/1f955be8cf8e58da06a0cb117b07d2ed9e9e923a/docs/examples/basic-price-oracle/main.go

@shuishihang
Copy link
Author

Because A knows about the channel AB and the invoice contains a "route hint" for the channel BC, which completes the route. But if you try to pay D, then the invoice route hint only contains CD and A is missing the information for the channel BC (it won't remember those channels that were previously in invoices).

Closing the issue as "won't fix" as asset channels at the edge will likely remain private even in the future. But feel free to comment further if you have more questions.

If I want to change the asset channels between B and C from private to public, is there any way to achieve this? The specific scenario is as follows: I have four nodes, A - B - C - D. A is the seller and needs to sell the asset to D. B is the intermediary, and C (which could include multiple nodes like C1, C2, etc.) is the supplier. The process flow is A -> B -> C -> D. Now, we want to find the optimal channel between B and C, but the channel between B and C is private and not visible. We want to change the channel to be public and visible. Is there a way to implement this process?

@guggero
Copy link
Member

guggero commented Feb 19, 2025

#1378 (comment)

@shuishihang
Copy link
Author

What I mean is that I want to change the asset channel between B and C to be publicly visible, instead of using a BTC channel. How should I go about doing this? Could you offer me some advice on how to achieve this?

@guggero
Copy link
Member

guggero commented Feb 19, 2025

You cannot. Asset channels cannot be public at this point, as that requires a network-wide rollout of this protocol upgrade: lightning/bolts#1059
That will probably take multiple months still.

@shuishihang
Copy link
Author

If my asset channel database file is mistakenly deleted and my local node can no longer find the asset, and in this case, the peer node that established the channel forcibly closes the asset channel, will the assets and satoshis in the channel be refunded to my node?

@guggero
Copy link
Member

guggero commented Feb 21, 2025

Not automatically, no. The usual backup and restore procedures that exist for normal LN channels are not yet in place. There can be some manual actions to attempt to restore, but that is rather complicated and requires the cooperation of the peer.
Making sure no data is lost should always be the absolute highest priority with any LN installation. Consider using a (replicated/clustered) Postgres backend for both lnd and tapd to avoid accidental data loss.

@shuishihang
Copy link
Author

Does this mean that once the channel is closed by the peer node, the sats in my channel can no longer be returned to my node?

@guggero
Copy link
Member

guggero commented Feb 21, 2025

It depends on what database file was deleted. But yes, with asset channels a database loss currently means high probability of loss of funds. See /~https://github.com/lightninglabs/taproot-assets?tab=readme-ov-file#mainnet

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
Development

No branches or pull requests

2 participants