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 11 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 Plus 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.79% +0.24%
==========================================
Files 327 328 +1
Lines 75032 76722 +1690
==========================================
+ Hits 55936 57382 +1446
- Misses 19096 19340 +244
|
|
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. |
Stop treating every loadwallet failure as permission to createwallet. The regtest fixtures already ship a `default` wallet, so the old fallback raced into "Database already exists" under parallel Windows CI. Clear stale fixture lock files, classify wallet RPC errors, surface readiness failures with debug.log context, and retain datadirs on startup panics so CI artifacts are useful. Fixes: dashpay#903
Remove needless returns in wallet availability confirmation and apply rustfmt to the readiness timeout helper.
Share cookie-based Client construction across wallet and base RPC paths, and clear stale fixture locks only in DashCoreNode::start so all callers get the same policy without a double walk from DashdTestContext.
Install RetainOnPanic only after start succeeds so startup failures retain once, share cookie-based soft/hard RPC client construction, and thin-wrap primary wallet send helpers. Fixture mining wallet now uses load_wallet.
Require a wallet-related message before treating a loadwallet failure as permission to createwallet, and cover the "Method not found" false positive in unit tests.
Stop the node before reading/copying debug.log so Windows retain does not hit sharing violations on open handles, and only load the last 64KiB of debug.log when dumping a readiness failure.
CI recovery: Windows / spv dashd startupPushed the #903 harness hardening (from #904, CI-green there including Windows / spv) onto this branch so PR CI can re-run against the real failure mode. Root cause (unchanged product code): parallel Windows Harness fix (dash-spv test_utils only):
Head: Local validation: |
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