Skip to content

[GEN-1815] Add coin selection strategy by feature flag - #564

Open
imclvr wants to merge 1 commit into
feat/improve-coin-selection-fffrom
feat/improve-coin-selection-refactor
Open

[GEN-1815] Add coin selection strategy by feature flag#564
imclvr wants to merge 1 commit into
feat/improve-coin-selection-fffrom
feat/improve-coin-selection-refactor

Conversation

@imclvr

@imclvr imclvr commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Enable utxo selection strategy by ff


Stack created with GitHub Stacks CLIGive Feedback 💬

@imclvr
imclvr requested review from Jossec101, RodriFS and daliclovr and a lite review from Copilot and removed request for Copilot August 12, 2026 12:27
public static List<UTXO> SelectUTXOsByClosest(
Wallet wallet, long satsAmount, List<UTXO> availableUTXOs, ILogger logger)
{
return new List<UTXO>();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't fail for sure 😬

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a feature-flag switch for transaction input (UTXO) selection in CoinSelectionService, allowing the service to route between the existing “oldest-first” selection and a new “closest-to-amount” strategy.

Changes:

  • Added ENABLE_COIN_SELECTION_BY_CLOSEST-gated routing in CoinSelectionService.GetTxInputCoins.
  • Introduced a new UTXOSelectionAlgorithms.SelectUTXOsByClosest entry point (currently stubbed).
  • Added tests to verify the feature-flag routing behavior, including a helper to create spendable UTXOs for ToCoins().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/NodeGuard.Tests/Services/CoinSelectionServiceTests.cs Adds routing tests for GetTxInputCoins under both flag states; adds spendable UTXO helper for coin conversion.
src/Services/CoinSelectionService.cs Routes coin selection between “oldest-first” and “closest” based on a feature flag.
src/Helpers/UTXOSelectionAlgorithms.cs Adds SelectUTXOsByClosest algorithm entry point (currently returns an empty selection).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Helpers/UTXOSelectionAlgorithms.cs
@imclvr
imclvr force-pushed the feat/improve-coin-selection-refactor branch from d879c5c to cf3c772 Compare August 17, 2026 07:45
@imclvr
imclvr requested a review from manumonti August 17, 2026 08:51
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 this pull request may close these issues.

2 participants