Skip to content

fix(key-wallet): consult every fund-bearing account for provider transactions - #1009

Merged
xdustinface merged 1 commit into
devfrom
fix/provider-tx-dashpay-accounts
Sep 12, 2026
Merged

xdustinface merged 1 commit into
devfrom
fix/provider-tx-dashpay-accounts

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

The four Provider* arms of get_relevant_account_types listed the standard and CoinJoin accounts but not the two DashPay ones. That list is not only a discovery hint: check_core_transaction marks a UTXO spent only for the account types it returns, so a provider transaction funded from a DashPay contact account had its inputs never debited. The spent coins kept counting toward the balance while the change output was credited on top - the same failure the AssetLock arm already documents from dashpay/platform#4073.

Nothing in the protocol confines a provider transaction's funding to one kind of account. DIP-3 lets a ProRegTx's collateral be an output of the ProRegTx itself, so its inputs pay for it; the three update transactions carry no collateral and DIP-3 is silent on their fee, which DIP-2 settles instead - "the inputs and outputs of special transactions usually have the same meaning as with classical transactions". Coins paid to the DIP-15 contact addresses a DashPay account receives on are ordinary UTXOs, spendable like any other.

Every arm now names the DIP that defines its transaction type, from DIP-2's type table, including Ignored (quorum commitments, DIP-6; masternode hard fork signals, DIP-23), which said nothing before.

Coinbase is deliberately left narrow, and its comment corrected: it claimed the payout is always a standard address, which DIP-3 contradicts - it requires only P2PKH or P2SH, and a CoinJoin or DashPay address is P2PKH too. A coinbase has no wallet inputs to debit, so a missed account costs an uncredited reward rather than a stale UTXO, and there is one in every block of a scan, making it the one arm where widening is paid for on the whole chain. That is a cost trade-off, not a correctness claim.

fund_bearing_with replaces the hand-rolled extension the AssetLock arm was doing.

Summary by CodeRabbit

  • Bug Fixes

    • Updated provider-related transaction handling to include DashPay receiving-funds and external accounts when determining relevant account types.
    • Applied consistent account handling to asset-lock transactions without changing their existing behavior.
  • Tests

    • Added coverage confirming DashPay account types are included for provider registration, updates, and revocations.

…sactions

The four `Provider*` arms of `get_relevant_account_types` listed the standard
and CoinJoin accounts but not the two DashPay ones. That list is not only a
discovery hint: `check_core_transaction` marks a UTXO spent only for the
account types it returns, so a provider transaction funded from a DashPay
contact account had its inputs never debited. The spent coins kept counting
toward the balance while the change output was credited on top - the same
failure the `AssetLock` arm already documents from dashpay/platform#4073.

Nothing in the protocol confines a provider transaction's funding to one kind
of account. DIP-3 lets a ProRegTx's collateral be an output of the ProRegTx
itself, so its inputs pay for it; the three update transactions carry no
collateral and DIP-3 is silent on their fee, which DIP-2 settles instead -
"the inputs and outputs of special transactions usually have the same meaning
as with classical transactions". Coins paid to the DIP-15 contact addresses a
DashPay account receives on are ordinary UTXOs, spendable like any other.

Every arm now names the DIP that defines its transaction type, from DIP-2's
type table, including `Ignored` (quorum commitments, DIP-6; masternode hard
fork signals, DIP-23), which said nothing before.

`Coinbase` is deliberately left narrow, and its comment corrected: it claimed
the payout is always a standard address, which DIP-3 contradicts - it requires
only P2PKH or P2SH, and a CoinJoin or DashPay address is P2PKH too. A coinbase
has no wallet inputs to debit, so a missed account costs an uncredited reward
rather than a stale UTXO, and there is one in every block of a scan, making it
the one arm where widening is paid for on the whole chain. That is a cost
trade-off, not a correctness claim.

`fund_bearing_with` replaces the hand-rolled extension the `AssetLock` arm was
doing.

Verified: the four provider routing tests now assert the DashPay types, 709
key-wallet and 647 dash-spv tests pass, clippy and rustfmt clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SbgCpMiBjnpvW4CyEEsKXw
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6d6d97f6-b1b6-401a-9ac2-187a3bb567fb

📥 Commits

Reviewing files that changed from the base of the PR and between 354a1cb and aad0918.

📒 Files selected for processing (2)
  • key-wallet/src/transaction_checking/transaction_router/mod.rs
  • key-wallet/src/transaction_checking/transaction_router/tests/provider.rs

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


📝 Walkthrough

Walkthrough

Provider transaction routing now uses a shared fund-bearing account helper. Provider registration and update routes include both DashPay account types. Tests verify all four provider transaction types.

Changes

Provider account routing

Layer / File(s) Summary
Shared fund-bearing account routing
key-wallet/src/transaction_checking/transaction_router/mod.rs
The router adds DashpayReceivingFunds and DashpayExternalAccount to provider transaction account sets. AssetLock uses the shared helper. Coinbase behavior remains unchanged.
Provider routing assertions
key-wallet/src/transaction_checking/transaction_router/tests/provider.rs
Tests verify DashPay account coverage for provider registration, service update, registrar update, and revocation transactions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: quantumexplorer

Merge Risk: ⚪ Minimal · up to aad09

Provider transactions now account for DashPay-funded inputs, preventing spent funds from remaining credited. The change is mergeable with minimal current risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: provider transactions now consult every fund-bearing account.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/provider-tx-dashpay-accounts

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.

@github-actions github-actions Bot added the ready-for-review CodeRabbit has approved this PR label Sep 10, 2026
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.27%. Comparing base (354a1cb) to head (aad0918).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1009   +/-   ##
=======================================
  Coverage   77.27%   77.27%           
=======================================
  Files         329      329           
  Lines       83624    83618    -6     
=======================================
- Hits        64617    64616    -1     
+ Misses      19007    19002    -5     
Flag Coverage Δ
core 78.25% <ø> (ø)
ffi 51.87% <ø> (-0.01%) ⬇️
rpc 20.00% <ø> (ø)
spv 92.04% <ø> (+0.02%) ⬆️
wallet 79.78% <100.00%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
...src/transaction_checking/transaction_router/mod.rs 90.24% <100.00%> (-0.46%) ⬇️

... and 5 files with indirect coverage changes

@xdustinface
xdustinface merged commit 59f656c into dev Sep 12, 2026
39 checks passed
@xdustinface
xdustinface deleted the fix/provider-tx-dashpay-accounts branch September 12, 2026 18:20
xdustinface pushed a commit that referenced this pull request Oct 21, 2026
…sactions (#1009)

The four `Provider*` arms of `get_relevant_account_types` listed the standard
and CoinJoin accounts but not the two DashPay ones. That list is not only a
discovery hint: `check_core_transaction` marks a UTXO spent only for the
account types it returns, so a provider transaction funded from a DashPay
contact account had its inputs never debited. The spent coins kept counting
toward the balance while the change output was credited on top - the same
failure the `AssetLock` arm already documents from dashpay/platform#4073.

Nothing in the protocol confines a provider transaction's funding to one kind
of account. DIP-3 lets a ProRegTx's collateral be an output of the ProRegTx
itself, so its inputs pay for it; the three update transactions carry no
collateral and DIP-3 is silent on their fee, which DIP-2 settles instead -
"the inputs and outputs of special transactions usually have the same meaning
as with classical transactions". Coins paid to the DIP-15 contact addresses a
DashPay account receives on are ordinary UTXOs, spendable like any other.

Every arm now names the DIP that defines its transaction type, from DIP-2's
type table, including `Ignored` (quorum commitments, DIP-6; masternode hard
fork signals, DIP-23), which said nothing before.

`Coinbase` is deliberately left narrow, and its comment corrected: it claimed
the payout is always a standard address, which DIP-3 contradicts - it requires
only P2PKH or P2SH, and a CoinJoin or DashPay address is P2PKH too. A coinbase
has no wallet inputs to debit, so a missed account costs an uncredited reward
rather than a stale UTXO, and there is one in every block of a scan, making it
the one arm where widening is paid for on the whole chain. That is a cost
trade-off, not a correctness claim.

`fund_bearing_with` replaces the hand-rolled extension the `AssetLock` arm was
doing.

Verified: the four provider routing tests now assert the DashPay types, 709
key-wallet and 647 dash-spv tests pass, clippy and rustfmt clean.

Claude-Session: https://claude.ai/code/session_01SbgCpMiBjnpvW4CyEEsKXw

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 59f656c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review CodeRabbit has approved this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants