fix(key-wallet): discover Coinbase/AssetUnlock outputs for all fund-bearing accounts#901
fix(key-wallet): discover Coinbase/AssetUnlock outputs for all fund-bearing accounts#901thepastaclaw wants to merge 4 commits into
Conversation
Coinbase and AssetUnlock outputs can pay any user-chosen address, including CoinJoin and DashPay. get_relevant_account_types previously returned only StandardBIP44/BIP32 for those classifications, so a match on those addresses was dropped after the block download — the credit-side mirror of the dashpay#867 AssetLock debit bug. Use fund_bearing_account_types() for both arms (membership-based discovery, like Dash Core's IsMine). Update routing unit tests to expect all five fund-bearing types. Closes dashpay#900
End-to-end regressions for dashpay#900: a coinbase mining reward and an AssetUnlock Platform withdrawal that pay a CoinJoin address must be discovered, create a UTXO on that account, and credit the wallet balance. Mirrors the dashpay#867 AssetLock debit regression shape; fails on pre-fix routing where only StandardBIP44/BIP32 were consulted for those classifications.
…serts Extract wallet_with_coinjoin_address() for the dashpay#900 credit regressions and assert Coinbase/AssetUnlock routing against fund_bearing_account_types() instead of re-listing the five types. Keeps the production list as the single source of truth for those unit tests.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #901 +/- ##
==========================================
- Coverage 74.54% 74.22% -0.33%
==========================================
Files 327 327
Lines 75032 75161 +129
==========================================
- Hits 55936 55786 -150
- Misses 19096 19375 +279
|
|
The failed Windows / spv job is unrelated to this PR. This branch changes only The job failed in the shared Windows dashd integration harness while starting nodes: two tests timed out waiting for dashd, and another hit The PR is proper as-is; no branch change or CI retrigger is warranted. I filed #903 to track the pre-existing Windows integration-test flake with both run links and investigation notes. |
Summary
TransactionRouter::get_relevant_account_typesreturned onlyStandardBIP44andStandardBIP32forCoinbaseandAssetUnlock, whilefund_bearing_account_types()is{StandardBIP44, StandardBIP32, CoinJoin, DashpayReceivingFunds, DashpayExternalAccount}. An output of a coinbase (masternode payout / mining reward) or an asset-unlock (Platform credit withdrawal) that pays a CoinJoin or DashPay address was therefore never matched, so the coin was never credited and the balance undercounted.This is the credit-side mirror of the debit-side routing bug fixed in #867 for
AssetLock. The same membership-based reasoning applies: discovery is like Dash Core'sIsMine, so consulting the full fund-bearing set cannot yield a false positive. Ownership still requires a scriptPubKey or spent UTXO that actually belongs to the account.Note the filter layer already does the right thing — the wallet queries all of its scripts, so the block is downloaded on a match. The output was then dropped purely by the account-type narrowing (wasted download + lost coin).
Closes #900
The fix
Replace the hand-written type lists in the
CoinbaseandAssetUnlockarms withfund_bearing_account_types(), mirroring #867. Roughly -8/+4 in production code; no signature changes.Also corrected the stale
Coinbasecomment that said "Check all account types" while listing only two.Membership safety (verified against source)
check_core_transactionscopes ownership detection toget_relevant_account_types.fund_bearing_account_types()is the same set used forStandard/CoinJoindiscovery and for the post-fix(key-wallet): cover CoinJoin/DashPay accounts for AssetLock routing #867AssetLockdebit path.fund_bearing_account_types,all_funding_accounts,update_utxosmatch) remains a separate refactor, as noted in key-wallet: coinbase and asset-unlock outputs paying CoinJoin/DashPay addresses are never discovered #900.Tests
CoinbaseandAssetUnlockassert equality withfund_bearing_account_types()(single source of truth).test_coinbase_paying_coinjoin_address_is_credited— coinbase to CoinJoin creates UTXO + immature/total balance credit.test_asset_unlock_paying_coinjoin_address_is_credited— AssetUnlock to CoinJoin creates UTXO + confirmed/total balance credit.wallet_with_coinjoin_address()fixture for the credit tests.Validation
Related