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

Automate lnd on-chain allowence to be sufficient for anchor closing #11

Closed
DanGould opened this issue Aug 8, 2022 · 3 comments · Fixed by payjoin/nolooking#38
Closed

Comments

@DanGould
Copy link

DanGould commented Aug 8, 2022

By

Note: if CHAIN_WALLET_AMOUNT_SATS is present another output will be added to send the amount to the internal wallet. This may be required in case the wallet is empty as in such case LND can not reserve sats for anchor commitments. However, to truly work, you need LND 0.14.2.

I thought LND 14.2 would be able to open a channel without setting CHAIN_WALLET_AMOUNT_SATS. What am I missing? Is there some setting to allow 0 internal wallet balance opens? Is that behavior even desirable or is the on-chain utxo better?

Running LND 14.2 (and 14.0, 14.3, 15.0) from lightning polar. Loptos works like a charm with CHAIN_WALLET_AMOUNT_SATS set sufficiently high.

@Kixunil
Copy link
Owner

Kixunil commented Aug 8, 2022

This is LND restriction because for anchors to safely work you need to have some onchain sats ready for fee bumping.
So if you already have min((number_of_currently_open_channels + number_of_channels_opened_by_loptos) * 10000, 100000) sats in the wallet you don't need CHAIN_WALLET_AMOUNT_SATS.
If you have less sats you need to add more sats to satisfy the condition. This can be done in the same transaction you open the channels by specifying the amount in CHAIN_WALLET_AMOUNT_SATS. In that case the transaction has these outputs (should be in random order):

  • channel_0
  • channel_1
  • ...
  • channel_n
  • change_to_payer
  • lnd_output

Where lnd_output is segwit-native p2pk belonging to LND. LND 14.2 and higher detects that this is happening and allows opening of the channel. In case the reserve was low older LND versions will incorrectly reject such transaction thinking the reserve is not high enough.

Hope it's clear. I guess this should be documented somewhere more clearly.

@Kixunil
Copy link
Owner

Kixunil commented Aug 8, 2022

Also forgot to mention there's a new LND RPC to reliably calculate the amount in sufficiently recent LND. We should use that to check the amount before attempting to open.

@DanGould DanGould changed the title LND 14.2: Transaction would have insufficient funds for fee bumping anchor channel closings Automate lndon-chain allowence to be sufficient for anchor closing Aug 8, 2022
@DanGould DanGould changed the title Automate lndon-chain allowence to be sufficient for anchor closing Automate lnd on-chain allowence to be sufficient for anchor closing Aug 8, 2022
@DanGould
Copy link
Author

That RequiredReserve RPC is in the WalletKit service. We need this PR in tonic_lnd to support walletrpc without hacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants