MutinyWallet / mutiny-node

SDK behind Mutiny Wallet
https://mutinywallet.com
MIT License
189 stars 35 forks source link

Channel Open Didn't Complete #603

Closed njelsalvador closed 1 year ago

njelsalvador commented 1 year ago

Hi,

I paid 100,000 sats to open a channel. And something has gone wrong in the process on the Mutiny side.

Payment Hash 5ef51d596ddd10bbc8c6bab0d2de541495426905154f3b658aa743261b14cd22

Payment ID 648dc2524f18fadfd81e9f12

Mutiny Wallet Log mutiny-logs.txt

Yesterday it said I had a channel but no liquidity.

This morning it says the channel is closed.

I'm unsure, but could guess, maybe the channel opening hasn't gone well and my funds are being refunded?

Thank you

TonyGiorgio commented 1 year ago

Thanks for the logs!

2023-06-17 19:50:12.346 INFO  [mutiny_core::nodemanager:760] Updated fee estimates!
...
2023-06-18 12:07:55.859 TRACE [mutiny_core::fees:130] Got fee rate from saved cache!
2023-06-18 12:07:55.861 ERROR [lightning::ln::channelmanager:5278] Closing channel X due to close-required error: Peer's feerate much too low. Actual: 3030. Our expected lower limit: 3500 (- 250)

It looks like it closed because our fee rate estimation was off, probably because we got it from the stored cache when we should have fetched the new fee rate. Our logic for when to fetch new fees does not look ideal in this case, it should have grabbed new fees the next day.

This helps a lot and should really help cut down on force closures once we fix it, thank you.

Couple questions:

  1. Since this was a normal channel closure, the funds should have appeared back on your on chain balance (minus on chain transaction fees), is that correct?
  2. Is this iOS or android?
njelsalvador commented 1 year ago

Hi Tony,

So some more details for you.

I sent it from my Blink wallet, iOS.

I now have a message in the Mutiny wallet about a "Channel Close" Reason" Peer's feerate much too low. Actual: 3030. Our exptected lower limit: 3500 (-250)"

I'm waiting on the funds to be refunded. I expect it to take about 48 hours, not the first time I have had a channel issue with self-custody wallets. I'm not panicing about it. Will update when I see the funds.

Something that might be relevant? I opened the Mutiny and Blink on the same phone. In the past I had an issue with I think it was Breeze, where I had restarted the wallet during the channel opening. This caused the issue I mention above.

I'm not sure, but when switching between apps, would this also possibly be an issue? I assume no, as I didn't close the app. But I notice some people do close when switching between. And this would happen when people to make invoice payments.

Just a thought.

Thank you

TonyGiorgio commented 1 year ago

I appreciate the details there and being understanding about the bugs, really sorry it happened but that log was really helpful and we'll get a fix for that and some other force close issues later this week. It does look like you will get the funds back after a day or two so that's good. Please let me know if that's not the case. I wonder if we can get better about saying when it'll get sweeped back.

Thanks!

njelsalvador commented 1 year ago

Hi Tony, So wanted to share that the channel refund never came through.

Is there some information I can provide to help identify what went wrong there?

Do you need new log file or other transaction details?

Hope it doesn't happen to much.

Thank you, James

TonyGiorgio commented 1 year ago

Interesting. Was there not a transaction called "Sweep" that showed up in the activity screen? If not, some more logs would help. There could be another problem with the on chain state that we should have a fix for soon, but some more logs would help indicate if that was it or not.

njelsalvador commented 1 year ago

Sorry about the delay, I missed the notification of the response.

No "sweep" transaction. Only one shows one the screen, as per the screenshot.

Have also attached the latest logs.

IMG_6257

mutiny-logs.txt

TonyGiorgio commented 1 year ago

Okay I took a closer look at the logs and I see this:

2023-06-17 14:26:12.383 TRACE [lightning::ln::inbound_payment:380] Failing HTLC with payment_hash 5ef51d596ddd10bbc8c6bab0d2de541495426905154f3b658aa743261b14cd22: expired payment

Which is another bug we've had and should be solved on the next release. So the channel did indeed open and the payment was routed to you but your mutiny wallet denied the payment. This has happened due to a bug needing LDK to sync a block before receiving their first payment (which sucks but has been fixed).

Then you ran into another bug that we fixed that caused a fee rate issue resulting in a force closure. According to the logs, the channel was closed with the full amount going back to the LSP: https://mempool.space/tx/0d89b3e3f3b689f5ee5a9a4a6a3894b535d61ac9a591168e22d8b82fe168d8f5

Given that it was not a "revoked lightning transaction" on mempool.space, this would indicate that it was a normal closure and confirms that the payment was not routed to you. Double check if the original payment from Blink actually sent out. See if you find a payment at that date & time with that payment hash above. It may have indicated it was pending at that time but it should have failed and you should have gotten your money back in Blink (it might show as failed or it might not even show up at all if they don't show failed payments).

njelsalvador commented 1 year ago

Ok, attached is the out going transaction from Blink.

And it says that the transaction is not found. https://mempool.space/tx/5ef51d596ddd10bbc8c6bab0d2de541495426905154f3b658aa743261b14cd22

So does that mean I need to go back to Blink and talk about this transaction? As it appears from what you say above, and what I'm seeing here, is that it never went out anyway.

And I can not find a corresponding incoming transaction to correct this.

Thank you. I hope all this is helping to make Mutiny better.

blink-IMG_6262

njelsalvador commented 1 year ago

I have opened a ticket with Blink. Will update with details when I know. Thank you

TonyGiorgio commented 1 year ago

The hash 5ef51d596ddd10bbc8c6bab0d2de541495426905154f3b658aa743261b14cd22 is a lightning payment, so it wouldn't show up on a blockchain explorer.

If they can produce a valid preimage that hashes to 5ef51d596ddd10bbc8c6bab0d2de541495426905154f3b658aa743261b14cd22 then the payment went through. They should really be showing that to users.. It is proof of payment. But once they look up that payment hash on their end, they should see that it did not go through because the preimage was never revealed. So Blink should refund you there.