Skip to content

feat(key-wallet): expose masternode_collateral and holds_coin - #1400

Merged
ZocoLini merged 1 commit into
devfrom
claude/key-wallet-public-collateral-helpers
Nov 13, 2026
Merged

ZocoLini merged 1 commit into
devfrom
claude/key-wallet-public-collateral-helpers

Conversation

@llbartekll

@llbartekll llbartekll commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1391. A wallet store that locks collateral on its own, for masternodes it tracks outside the wallet's registrations, needs the same two answers the wallet uses: which outpoint a ProRegTx registers, and whether the wallet holds that coin. Both were crate-private, so dashpay/platform#5890 carries copies, and its copy of holds_coin looks only at the UTXO set and misses a coin the wallet keeps aside as spent.

This makes ManagedWalletInfo::holds_coin public and re-exports masternode_collateral from wallet::managed_wallet_info. No behaviour changes.

🤖 Generated with Claude Code

PR Hygiene · f09d989

  • Bots — coderabbitai ✓
  • Self-review — post /self-reviewed
  • Build running
  • Approvals
    • key-wallet (key-wallet/src/wallet/managed_wallet_info/locked_outpoints.rs, key-wallet/src/wallet/managed_wallet_info/mod.rs) — QuantumExplorer or ZocoLini or xdustinface

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • New Features
    • Expanded the public wallet API with access to masternode collateral lookup and checks for whether a wallet holds a specified coin. Existing behavior is unchanged. This update is relevant to applications and integrations that use the wallet API; it does not change the wallet’s visible behavior.

A wallet store that locks collateral on its own, for masternodes it tracks outside the wallet's registrations, needs the same two answers the wallet uses: which outpoint a ProRegTx registers, and whether the wallet holds that coin. Without them it copies the logic and drifts: a copy that looks only at the UTXO set misses a coin the wallet keeps aside as spent.

`masternode_collateral` is re-exported from `wallet::managed_wallet_info`, and `ManagedWalletInfo::holds_coin` becomes public. No behaviour changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request makes masternode_collateral and ManagedWalletInfo::holds_coin public. It also re-exports masternode_collateral from managed_wallet_info.

Changes: Managed wallet API

Layer / File(s) Summary
Expose managed-wallet functions
key-wallet/src/wallet/managed_wallet_info/locked_outpoints.rs, key-wallet/src/wallet/managed_wallet_info/mod.rs
masternode_collateral and ManagedWalletInfo::holds_coin are now public. managed_wallet_info publicly re-exports masternode_collateral.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Feature

Possibly related PRs

Suggested reviewers: xdustinface, zocolini

Merge Risk: Minimal · up to f09d9

This change exposes two existing wallet helpers publicly without altering their behavior. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two changed items, masternode_collateral and holds_coin, and the crate they belong to. The raw summary confirms both functions move from crate-visible to public, and that `mod.…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two changed items, masternode_collateral and holds_coin, and the crate they belong to. The raw summary confirms both functions move from crate-visible to public, and that mod.rs re-exports masternode_collateral. The title matches the main change and the PR objectives.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c320718 and f09d989.

Files selected for processing: 2

  • key-wallet/src/wallet/managed_wallet_info/locked_outpoints.rs
  • key-wallet/src/wallet/managed_wallet_info/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@manki-review

manki-review Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

✅ Review complete in 2m 17s

Planner (7s)
    feat · 5 lines · 2 agents
    judge effort: medium

Review (security · pair): 0 findings
    ✅ Claude Sonnet 5.5 · high: 0 findings (9s)
    ✅ Claude Opus 5.5 · high: 0 findings (22s)

Judge: 0 kept · 0 dropped (19s)

Review metadata

Config:

  • Models: reviewer=claude-sonnet-5-5, judge=claude-opus-5-5
  • Triage: trivial=false, subtle=true, paired=true (planner, security-sensitive paths)
  • Team: Claude Sonnet 5.5 · high, Claude Opus 5.5 · high
  • Memory: enabled (central)

Account limits:

  • Claude subscription: weekly 98% (resets 2026-11-17 05:00 UTC)

Timing:

  • Parse: 6.8s
  • Review agents: 111.8s
  • Judge: 18.5s
  • Total: 137.1s

Last reviewed f09d989 · head f09d989 · up to date

  • Pause automatic reviews
  • Review again
  • Deeper review

@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 13, 2026

@manki-review manki-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Approved.

Caution

Claude subscription has used 98% of its weekly limit, past the 90% mark. It resets 2026-11-17 05:00 UTC.

Once a limit is used up, reviews on that account stop until it resets.

What this does: Two wallet helpers were usable only inside the key-wallet crate. One finds the collateral coin a masternode registration names, the other checks whether the wallet holds a coin.


Related work: open PRs and issues that may cover the same change. None of them blocks.


What to test

The review model wrote these steps. Check what a step runs before you follow it.

Setup: Build a small crate or test that depends on key-wallet and imports key_wallet::wallet::managed_wallet_info::masternode_collateral.

  1. Call masternode_collateral on a ProRegTx that names an external collateral outpoint. Expect Some of that outpoint.
  2. Call it on a ProRegTx with a null collateral txid and an index inside its outputs. Expect Some(OutPoint::new(tx.txid(), index)).
  3. Call it on a regular payment transaction. Expect None.
  4. Call ManagedWalletInfo::holds_coin on an outpoint the wallet received. Expect true.
  5. Call holds_coin on an outpoint the wallet never owned. Expect false.
  6. Edge case: call masternode_collateral on a ProRegTx with a null collateral txid and an index past its outputs. Expect None.
  7. Edge case: spend a wallet coin in a block, then call holds_coin on it. Expect true while the account keeps it aside as spent.
About this review
  • Reviewed f09d989, round 1
  • 5 changed lines read in 2m 17s
  • Found by claude-sonnet-5-5 and claude-opus-5-5, judged by claude-opus-5-5
  • Tokens: 351k in (224k from cache) · 5k out · about $0.64 at API prices
  • How Manki reviews

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 13, 2026
@ZocoLini
ZocoLini merged commit d659dcd into dev Nov 13, 2026
39 of 41 checks passed
@ZocoLini
ZocoLini deleted the claude/key-wallet-public-collateral-helpers branch November 13, 2026 09:59
manki-review Bot added a commit to manki-review/review-memory that referenced this pull request Nov 13, 2026
@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.81%. Comparing base (c320718) to head (f09d989).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1400   +/-   ##
=======================================
  Coverage   85.81%   85.81%           
=======================================
  Files         269      269           
  Lines       70847    70847           
=======================================
+ Hits        60799    60800    +1     
+ Misses      10048    10047    -1     
Flag Coverage Δ
core 82.81% <ø> (ø)
rpc 52.10% <ø> (ø)
spv 94.41% <ø> (+<0.01%) ⬆️
wallet 83.89% <100.00%> (ø)
Files with missing lines Coverage Δ
...src/wallet/managed_wallet_info/locked_outpoints.rs 100.00% <100.00%> (ø)
key-wallet/src/wallet/managed_wallet_info/mod.rs 79.21% <ø> (ø)

... and 5 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants