Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

UTXO consolidation #10295

pranav-punjabi started this conversation in General
Oct 15, 2025 · 2 comments · 1 reply
Discussion options

I have a question regarding coin selection and fee estimation in LND.

suppose a merchant, receive payments in sats, which results in many small UTXOs spread across multiple addresses for example, several 100ドル UTXOs or similar-sized ones.

  • By default, LND seems to prefer picking larger UTXOs for efficient transactions, which makes sense.
  • However, when I explicitly set the coin selection strategy to RANDOM, LND often selects many smaller UTXOs to complete a payment.
  • This increases the overall transaction size and, therefore, the total fee.

Here’s the issue I’m facing:

  1. When I call EstimateFee with CoinSelectionStrategy = RANDOM, the node picks one random combination of UTXOs to estimate the fee.

  2. A few seconds later, when I call SendCoins (also with CoinSelectionStrategy = RANDOM), it picks a different random set of UTXOs.

  3. Because of this, the actual transaction size — and therefore the actual fee — can differ a lot from the estimated value.

So the fee estimation becomes unpredictable.

My question:

  • Would it be possible for the EstimateFee API response to include which UTXOs were used for the estimation (their outpoints), so that we can pass those exact UTXOs in the SendCoins request?

  • That way, we could eliminate this randomness and achieve predictable behavior between estimation and execution.

Additionally :

  1. Do you have any suggestions or recommended practices for UTXO management in this scenario?
    For example, does LND provide a built-in mechanism to consolidate UTXOs automatically when network fees are low or when the number of small UTXOs crosses a threshold?

  2. Or How should we handle consolidation manually (e.g., using SendCoins to self-addresses during low-fee periods) or any other aproch which is best for us?

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Hi @pranav-punjabi,

I added a draft PR that adds the feature you are requesting, see #10296.
Let me know what you think.

You must be logged in to vote
0 replies
Comment options

Additionally :

  1. Do you have any suggestions or recommended practices for UTXO management in this scenario?
    For example, does LND provide a built-in mechanism to consolidate UTXOs automatically when network fees are low or when the number of small UTXOs crosses a threshold?
  2. Or How should we handle consolidation manually (e.g., using SendCoins to self-addresses during low-fee periods) or any other aproch which is best for us?

Afaik lnd does not provide an built-in mechanism.

As suggested on Slack you could either create your own script that consolidates periodically according to your needs.
Alternatively, you could check out https://docs.lightning.engineering/lightning-network-tools/loop/static-loop-in-addresses

If you get your users to send funds to a static loop address you could from time-to-time swap all the received on-chain outputs
with a lightning payment to your lightning node.

You must be logged in to vote
1 reply
Comment options

thank you @hieblmi , it is very helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features / behaviour
Converted from issue

This discussion was converted from issue #10294 on October 15, 2025 13:01.

AltStyle によって変換されたページ (->オリジナル) /