Skip to content

feat: wallet transaction confirmation lifecycle#540

Draft
xdustinface wants to merge 3 commits intov0.42-devfrom
feat/wallet-confirmation-lifecycle
Draft

feat: wallet transaction confirmation lifecycle#540
xdustinface wants to merge 3 commits intov0.42-devfrom
feat/wallet-confirmation-lifecycle

Conversation

@xdustinface
Copy link
Collaborator

Add InstantSend transaction context and transaction state management
so wallet transactions can transition through confirmation stages
(mempool → InstantSend → block → chain-locked block).

Key changes:

  • Add TransactionContext::InstantSend variant with FFI support
  • Track known transactions to avoid double-counting
  • Add confirm_transaction() for mempool→block transitions
  • Add IS lock dedup set to prevent redundant processing
  • Update balance after any UTXO state change
  • Add status_changed field to TransactionCheckResult
  • Add TestWalletContext::with_mempool_funding() helper
  • Add more relevant tests

commit 0077e89
Author: xdustinface <xdustinfacex@gmail.com>
Date:   Sun Mar 15 13:52:27 2026 +0700

    test: consolidate test transaction creation

    - Add `Transaction::empty()` for creating transactions with no inputs/outputs, replacing the private `create_test_transaction()` in `transaction_record.rs`
    - Remove `create_transaction_to_address` from `key-wallet/src/test_utils/wallet.rs` and replace all call sites in `wallet_checker` tests with `Transaction::dummy`
    - Remove `create_test_transaction` from router test helpers and replace all call sites across all router test files with `Transaction::dummy`
    - Add `test_addr()` helper in router test helpers to reduce verbosity
commit c9e13c1
Author: xdustinface <xdustinfacex@gmail.com>
Date:   Sun Mar 15 13:54:02 2026 +0700

    test: extract wallet setup into `TestWalletContext`

    Add `TestWalletContext` struct to `test_utils::wallet` providing a
    pre-built testnet wallet with BIP44 account, receive address, and xpub.
    Replace duplicated wallet setup code across `wallet_checker`, `routing`,
    `coinbase`, and `asset_unlock` test modules.
Add `InstantSend` transaction context and transaction state management
so wallet transactions can transition through confirmation stages
(mempool → InstantSend → block → chain-locked block).

Key changes:
- Add `TransactionContext::InstantSend` variant with FFI support
- Track known transactions to avoid double-counting
- Add `confirm_transaction()` for mempool→block transitions
- Add IS lock dedup set to prevent redundant processing
- Update balance after any UTXO state change
- Add `status_changed` field to `TransactionCheckResult`
- Add `TestWalletContext::with_mempool_funding()` helper
- Add more relevant tests
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eb8a1675-d3b0-4e13-96a1-c182d46cbf9f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/wallet-confirmation-lifecycle
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 94.78673% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.62%. Comparing base (b946271) to head (c61972c).
⚠️ Report is 1 commits behind head on v0.42-dev.

Files with missing lines Patch % Lines
...allet/managed_wallet_info/wallet_info_interface.rs 0.00% 8 Missing ⚠️
key-wallet/src/managed_account/mod.rs 96.77% 1 Missing ⚠️
...-wallet/src/transaction_checking/wallet_checker.rs 99.38% 1 Missing ⚠️
key-wallet/src/wallet/managed_wallet_info/mod.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev     #540      +/-   ##
=============================================
- Coverage      66.89%   65.62%   -1.28%     
=============================================
  Files            313      313              
  Lines          64753    64819      +66     
=============================================
- Hits           43317    42535     -782     
- Misses         21436    22284     +848     
Flag Coverage Δ *Carryforward flag
core 75.02% <ø> (ø)
dash-network 75.00% <ø> (ø) Carriedforward from b946271
dash-network-ffi 34.75% <ø> (-0.01%) ⬇️ Carriedforward from b946271
dash-spv 68.26% <ø> (ø) Carriedforward from b946271
dash-spv-ffi 34.75% <ø> (-0.01%) ⬇️ Carriedforward from b946271
dashcore 75.00% <ø> (ø) Carriedforward from b946271
dashcore-private 75.00% <ø> (ø) Carriedforward from b946271
dashcore-rpc 19.92% <ø> (ø) Carriedforward from b946271
dashcore-rpc-json 19.92% <ø> (ø) Carriedforward from b946271
dashcore_hashes 75.00% <ø> (ø) Carriedforward from b946271
ffi ?
key-wallet 65.40% <ø> (-0.25%) ⬇️ Carriedforward from b946271
key-wallet-ffi 34.75% <ø> (-0.01%) ⬇️ Carriedforward from b946271
key-wallet-manager 65.40% <ø> (-0.25%) ⬇️ Carriedforward from b946271
rpc 19.92% <ø> (ø)
spv 81.09% <ø> (+<0.01%) ⬆️
wallet 65.77% <94.78%> (+0.09%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
key-wallet-ffi/src/transaction.rs 0.00% <ø> (ø)
key-wallet-ffi/src/transaction_checking.rs 0.79% <ø> (-0.53%) ⬇️
key-wallet-ffi/src/types.rs 59.67% <ø> (-0.01%) ⬇️
...y-wallet/src/managed_account/transaction_record.rs 100.00% <100.00%> (ø)
...wallet/src/transaction_checking/account_checker.rs 63.96% <100.00%> (ø)
key-wallet/src/managed_account/mod.rs 49.44% <96.77%> (+2.87%) ⬆️
...-wallet/src/transaction_checking/wallet_checker.rs 94.68% <99.38%> (+0.56%) ⬆️
key-wallet/src/wallet/managed_wallet_info/mod.rs 57.14% <66.66%> (+0.53%) ⬆️
...allet/managed_wallet_info/wallet_info_interface.rs 71.17% <0.00%> (-5.53%) ⬇️

... and 20 files with indirect coverage changes

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.

1 participant