Skip to content

[GEN-1815] Implement closest utxo selection algorithm - #565

Open
imclvr wants to merge 1 commit into
feat/improve-coin-selection-refactorfrom
feat/improve-coin-selection-with-ff
Open

[GEN-1815] Implement closest utxo selection algorithm#565
imclvr wants to merge 1 commit into
feat/improve-coin-selection-refactorfrom
feat/improve-coin-selection-with-ff

Conversation

@imclvr

@imclvr imclvr commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Title self-explanatory


Stack created with GitHub Stacks CLIGive Feedback 💬

@imclvr
imclvr requested review from Jossec101, RodriFS and daliclovr and a lite review from Copilot August 12, 2026 12:29

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 implements a “closest-to-amount” UTXO selection algorithm in UTXOSelectionAlgorithms and adds/updates unit tests to validate both the new selection behavior and the CoinSelectionService routing flag.

Changes:

  • Implemented SelectUTXOsByClosest and refactored shared argument/funding validation into a helper method.
  • Added dedicated unit tests for the closest-selection algorithm, plus shared “no UTXOs” / “insufficient funds” coverage for both algorithms.
  • Strengthened an existing CoinSelectionService test to ensure the “closest” path produces a non-empty, distinguishable selection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
test/NodeGuard.Tests/Services/CoinSelectionServiceTests.cs Tightens the closest-selection routing assertion by ensuring the expected selection is non-empty.
test/NodeGuard.Tests/Helpers/UTXOSelectionAlgorithmsTests.cs Adds focused unit tests for the closest-selection algorithm plus shared edge-case coverage.
src/Helpers/UTXOSelectionAlgorithms.cs Implements closest-selection and introduces shared validation logic for selection algorithms.

💡 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
Comment thread src/Helpers/UTXOSelectionAlgorithms.cs
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