Skip to content

chore(key-wallet): drop unused UtxoSet struct#491

Open
ZocoLini wants to merge 1 commit intov0.42-devfrom
chore/drop-unused-utxoset
Open

chore(key-wallet): drop unused UtxoSet struct#491
ZocoLini wants to merge 1 commit intov0.42-devfrom
chore/drop-unused-utxoset

Conversation

@ZocoLini
Copy link
Collaborator

@ZocoLini ZocoLini commented Mar 3, 2026

We are not using this struct internally and I don't see any value on having it for library users

Summary by CodeRabbit

  • Breaking Changes
    • Removed UtxoSet from the public API. The Utxo type remains available for use.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

The changes remove the UtxoSet public struct and all associated methods from the key-wallet crate. The struct definition, approximately 20 methods, the Default implementation, and all unit tests are deleted from utxo.rs. Public re-exports of UtxoSet are removed from both key-wallet/src/lib.rs and key-wallet-manager/src/lib.rs. The Utxo type remains available.

Changes

Cohort / File(s) Summary
UtxoSet Removal from Exports
key-wallet/src/lib.rs, key-wallet-manager/src/lib.rs
Removed UtxoSet from public re-exports. Both files now only export the Utxo type instead of the paired {Utxo, UtxoSet} import.
UtxoSet Implementation Deletion
key-wallet/src/utxo.rs
Deleted the entire UtxoSet public struct definition, all ~20 public methods (add, remove, get, contains, all, spendable, total_balance, lock_utxo, unlock_utxo, etc.), Default trait implementation, and all associated unit tests. The Utxo struct and its methods remain intact.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A set once held these UTXOs tight,
But simplicity won the fight,
With just one type to recommend,
The API's cleaner in the end! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing the unused UtxoSet struct from the key-wallet crate, which is the core focus across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/drop-unused-utxoset

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@key-wallet/src/lib.rs`:
- Line 72: The public API removed UtxoSet but the README example still imports
and uses it; update the example to stop referencing UtxoSet and show usage with
Utxo only. Edit the README example that currently does `use ...::UtxoSet` and
replace the snippet with code that constructs/iterates/manipulates Utxo
instances (e.g., creating Utxo values, collecting them into a Vec or other local
container, and using the existing Utxo APIs) so documentation compiles against
the current public export `Utxo`.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c8e81f and ef1333c.

📒 Files selected for processing (3)
  • key-wallet-manager/src/lib.rs
  • key-wallet/src/lib.rs
  • key-wallet/src/utxo.rs
💤 Files with no reviewable changes (1)
  • key-wallet/src/utxo.rs

pub use mnemonic::Mnemonic;
pub use seed::Seed;
pub use utxo::{Utxo, UtxoSet};
pub use utxo::Utxo;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for any remaining references to UtxoSet in the codebase

echo "=== Searching for UtxoSet references in Rust files ==="
rg -n 'UtxoSet' --type rust

echo -e "\n=== Searching in markdown/docs ==="
rg -n 'UtxoSet' --type md || echo "No markdown references found"

echo -e "\n=== Checking for any other file types mentioning UtxoSet ==="
rg -n 'UtxoSet' --glob '*.toml' --glob '*.txt' || echo "No toml/txt references found"

Repository: dashpay/rust-dashcore

Length of output: 388


🏁 Script executed:

#!/bin/bash
# Check the README content to see how UtxoSet is used in the documentation
echo "=== Checking key-wallet-manager/README.md around lines 154-157 ==="
sed -n '150,160p' key-wallet-manager/README.md

echo -e "\n=== Checking if UtxoSet is exported from key-wallet-manager lib.rs ==="
if [ -f "key-wallet-manager/src/lib.rs" ]; then
  rg -n 'UtxoSet' key-wallet-manager/src/lib.rs || echo "No UtxoSet exports in key-wallet-manager/lib.rs"
fi

echo -e "\n=== Checking key-wallet/src/utxo.rs to see if UtxoSet definition still exists ==="
if [ -f "key-wallet/src/utxo.rs" ]; then
  rg -n 'pub struct UtxoSet' key-wallet/src/utxo.rs -A 3
fi

Repository: dashpay/rust-dashcore

Length of output: 539


🏁 Script executed:

#!/bin/bash
# Check the full key-wallet/src/utxo.rs file
echo "=== Checking key-wallet/src/utxo.rs ==="
wc -l key-wallet/src/utxo.rs

# Search for UtxoSet anywhere in the file
echo -e "\n=== Searching for UtxoSet ==="
cat key-wallet/src/utxo.rs | grep -n -i 'utxoset'

# Show the file structure with pub struct/enum definitions
echo -e "\n=== Public definitions in utxo.rs ==="
rg 'pub (struct|enum|type)' key-wallet/src/utxo.rs

Repository: dashpay/rust-dashcore

Length of output: 219


Breaking API change: UtxoSet removed from public exports and entire codebase.

UtxoSet has been completely removed from the crate. However, the example code in key-wallet-manager/README.md (lines 154–157) still imports and uses UtxoSet, which will no longer work. Update the documentation to remove or replace this example with code that only uses Utxo.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@key-wallet/src/lib.rs` at line 72, The public API removed UtxoSet but the
README example still imports and uses it; update the example to stop referencing
UtxoSet and show usage with Utxo only. Edit the README example that currently
does `use ...::UtxoSet` and replace the snippet with code that
constructs/iterates/manipulates Utxo instances (e.g., creating Utxo values,
collecting them into a Vec or other local container, and using the existing Utxo
APIs) so documentation compiles against the current public export `Utxo`.

Copy link

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Looks good — removing unused abstractions keeps the API surface clean. 👍

One thing to address: as CodeRabbit flagged, key-wallet-manager/README.md still references UtxoSet in the UTXO Management example (lines 154-167). That example will need updating to only use Utxo directly, or the section can be simplified/removed if there's no meaningful standalone Utxo usage example to show.

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