-
Notifications
You must be signed in to change notification settings - Fork 122
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 local/remote balances not updating #1279
Comments
I'm not 100% sure I fully understand the scenario yet. But two things look weird to me from the start:
|
@guggero In the payment request the
so when I do
Note I also cut out using a hop hint of node A, I just have node B in here now. A is both the invoice creator and the one who is paying the invoice, using B as the intermediary hop. With all these changes expressed I am still witnessing the same behaviors described in original issue. Perhaps I am using the wrong scid for the Are the route hints provided in the invoice actually used when making the payment, or are they merely a suggestion? It feels like when the payment is made it considers the route hint, but does not necessarily use the route even if the route has adequate liquidity to service the payment. |
You don't need to manually populate hop hints at all. If you have an invoice, then hop hints are included in the invoice. Can you try your scenario just using the vanilla invoice as is? When you make an asset invoice, the hop hints are set up such that we only make one feasible path to the destination. Bitcoin invoices operate as normal. It sounds like you're trying to pay an invoice back to yourself. When you have many channels between yourself and the other node, lnd will pick at runtime which channel it will go over. Unless you restrict both the outgoing and incoming channels. |
Correct. In my setup here I only have 1 sat channel and 1 asset channel between the 2 nodes. Both nodes do not have any other channels. However I would like going forward to be able to have more channels for each node (both with each other and with other peers), and to be able to specify specifically which channels to route the payment through.
I used this for the payment, where
|
Background
In a 2 node set up, there exists between the nodes 1 sat channel and one taproot asset channel.
Node A generates an asset invoice. Node A also then pays this same invoice using sats.
Node A's local balance on the sat channel should decresae, and Node A's asset balance on the asset channel should increase. What I have witnessed is ~20% chance that this desired result happens. The other 80% of the time Node A's sat channel local balance decreases, and the balances on the asset channel remain unchanged, effectively meaning node A has paid sats and received nothing in return. In both scenarios, the payment and invoice show successful states, and show that intented route was used.
Node A has adequate liquidity on their sat channel to make the payment in sats, and their asset channel has adequate liquidity to receive on the asset channel. Fee policy is not preventing the payment.
Your environment
Steps to reproduce
First evaluate the local/remote balances of both the sat and asset channel.
Then the invoice can be generated with
tapchannelrpc.TaprootAssetChannelsClient.AddInoice
.The payment is then made with
routerrpc.RouterClient.SendPaymentV2
. The payment request looks like:With trace level logging on for lnd and taproot assets, the logs become very verbose but a couple lines stand out to me:
In the case where the desired result happens (asset channel balances update) I see:
queueing keystone of ADD open circuit: (Chan ID=523:1:0, HTLC ID=1)->(Chan ID=513:1:0, HTLC ID=1)
and
Closed completed SETTLE circuit for 3b437af9ae09c1551a3dea1c88687424fba8b19ba968f2576501d11ed0bf0577: (523:1:0, 1) <-> (513:1:0, 1)
(where3b437af9ae09c1551a3dea1c88687424fba8b19ba968f2576501d11ed0bf0577
happens to be the payment hash I can see in the invoice)In the bad case where the asset channel balances do not update I see:
queueing keystone of ADD open circuit: (Chan ID=523:1:0, HTLC ID=1)->(Chan ID=523:1:0, HTLC ID=0)
andClosed completed SETTLE circuit for 3b437af9ae09c1551a3dea1c88687424fba8b19ba968f2576501d11ed0bf0577: (523:1:0, 1) <-> (523:1:0, 0)
This leads me to believe that the route being used is using the same channel for both hops. In both of these cases the
523
channel is the sats channel. I have never seen it use both hops being the asset channel (the513
channel).In the failure case I also see:
[DBG] CRTR: Attempt 2 for payment 3b437af9ae09c1551a3dea1c88687424fba8b19ba968f2576501d11ed0bf0577 successfully sent to switch, route: 575044581392384 (99801090 mSAT) -> 17661713758531595845 (99799991 mSAT), cltv 759
which when I evaluate those channel ids in the route tells me that is is a correct sats -> asset route. Given that this is attempt 2 perhaps there is some sort of conflict with another attempt or htlc?Happy to provide more logs if needed.
It feels like the route I provided in the route hints is merely a suggestion, and not being used. I am unsure if
SendToRouteV2
would respect it.Expected behavior
From Node A's perspective the sat channel's local balance should be decremented. On Node A's asset channel their sat local balance should increase as well as the amount of asset units reflected in the custom data. The payment should also settle (as it has).
Actual behavior
After the payment is made, checking the status shows
Payment_SUCCEEDED
. Inspecting the htlcs in this payment and the underlying route for the 1lnrpc.HTLCAttempt
revals the two hop's channel ids map to the same two channels supplied in the payment request's route hints. I also noted that the second hop's channel id appears to be in the scid format (and I checked it does map to the asset channel), however in the payment request I used a channel id format supplied fromlncli listchannels
.Inspecting the invoice (using
lnrpc.LookupInvoice
) after the successful payment reveals a state oflnrpc.Invoice_SETTLED
and for the correct sat amount.The local balance (from Node A's persepctive) was properly decremented. Both local/remote balances (for both the sat amount and asset amount) on the asset channel remain unchanged.
I tossed in a custom log line around here to see if
isAssetInvoice
istrue
and in every case it is true.Something pretty interesting is that I have had a 100% success rate if I do this same flow but using the CLI:
In these CLI command I do not specify the entire route, just the outgoing channel id, but other than that it is pretty similar to how I have created the invoice and paid it in the code using the rpc calls. Unclear why the CLI would always succeed and not doing this flow via the rpc.
The text was updated successfully, but these errors were encountered: