Skip to content

feat: track input/output details and direction in TransactionRecord#605

Merged
QuantumExplorer merged 1 commit into
v0.42-devfrom
feat/transaction-record-details
Apr 1, 2026
Merged

feat: track input/output details and direction in TransactionRecord#605
QuantumExplorer merged 1 commit into
v0.42-devfrom
feat/transaction-record-details

Conversation

@xdustinface

@xdustinface xdustinface commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Add InputDetail, OutputDetail, OutputRole, and TransactionDirection to capture which inputs/outputs are wallet-relevant and classify the transaction direction at recording time.

Summary by CodeRabbit

  • New Features
    • Transaction records now include richer metadata: explicit transaction-type tagging, direction classification (incoming/outgoing/internal/coinjoin), per-input details, and per-output roles (received/change/sent/unspendable) with associated addresses.
  • Tests
    • Expanded test coverage validating direction, transaction-type, net amounts and per-input/output role/index/address behaviors across many transaction shapes.

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e49b928c-0b68-46b9-bdba-c8cc30a15434

📥 Commits

Reviewing files that changed from the base of the PR and between 6cc4bdc and b77532c.

📒 Files selected for processing (8)
  • key-wallet-ffi/src/managed_account.rs
  • key-wallet/src/account/mod.rs
  • key-wallet/src/managed_account/mod.rs
  • key-wallet/src/managed_account/transaction_record.rs
  • key-wallet/src/tests/spent_outpoints_tests.rs
  • key-wallet/src/transaction_checking/account_checker.rs
  • key-wallet/src/transaction_checking/transaction_router/mod.rs
  • key-wallet/src/transaction_checking/wallet_checker.rs
💤 Files with no reviewable changes (1)
  • key-wallet-ffi/src/managed_account.rs
✅ Files skipped from review due to trivial changes (1)
  • key-wallet/src/account/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • key-wallet/src/transaction_checking/account_checker.rs

📝 Walkthrough

Walkthrough

Replaces the is_ours: bool transaction flag with richer metadata: transaction type, direction, per-input details, and per-output roles. Transaction-type is threaded through confirmation/recording flows; recording now derives input/output details and direction. The FFI layer removes the boolean field accordingly.

Changes

Cohort / File(s) Summary
FFI Layer
key-wallet-ffi/src/managed_account.rs
Removed pub is_ours: bool from FFITransactionRecord and stopped assigning it when copying transaction records to the FFI representation.
Public Re-exports
key-wallet/src/account/mod.rs
Expanded re-exports to expose InputDetail, OutputDetail, OutputRole, TransactionDirection alongside TransactionRecord.
Transaction Record Types
key-wallet/src/managed_account/transaction_record.rs
Added InputDetail, OutputDetail, OutputRole, and TransactionDirection; replaced TransactionRecord.is_ours with transaction_type, direction, input_details, output_details; updated TransactionRecord::new signature and related methods/tests.
Core Transaction Recording
key-wallet/src/managed_account/mod.rs
confirm_transaction and record_transaction now take TransactionType; record_transaction computes input_details, resolves outputs, assigns OutputRole per output, derives TransactionDirection, and constructs the expanded TransactionRecord.
Account Address Helpers
key-wallet/src/transaction_checking/account_checker.rs
Added CoreAccountTypeMatch::involved_receive_addresses() and ::involved_change_addresses() to expose receive/change address slices tailored per account type.
Transaction Type Traits
key-wallet/src/transaction_checking/transaction_router/mod.rs
Made TransactionType Copy and added conditional Serde derives behind the serde feature.
Processing & Tests
key-wallet/src/transaction_checking/wallet_checker.rs, key-wallet/src/tests/...
Threaded tx_type through wallet/account calls, updated tests to classify transactions via TransactionRouter::classify_transaction, and added extensive tests asserting direction, transaction_type, input/output roles, and other record details (including CoinJoin, coinbase, OP_RETURN cases).
Test Helpers
key-wallet/src/tests/spent_outpoints_tests.rs
Updated record_from_tx helper to call the new TransactionRecord::new(...) signature with TransactionType/TransactionDirection and empty detail vectors.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 I nibble through bytes and hop with cheer,
I traded is_ours for details clear.
Inputs counted, outputs named with role,
Directions set, the ledger feels whole.
Hooray—transactions now wear a soul!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main feature: adding input/output details and direction tracking to TransactionRecord.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feat/transaction-record-details

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.

@xdustinface
xdustinface marked this pull request as draft March 31, 2026 09:01
@xdustinface

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61029% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.40%. Comparing base (9cf8691) to head (b77532c).
⚠️ Report is 2 commits behind head on v0.42-dev.

Files with missing lines Patch % Lines
...wallet/src/transaction_checking/account_checker.rs 74.07% 7 Missing ⚠️
key-wallet/src/managed_account/mod.rs 92.85% 5 Missing ⚠️
...-wallet/src/transaction_checking/wallet_checker.rs 99.74% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev     #605      +/-   ##
=============================================
+ Coverage      67.15%   67.40%   +0.25%     
=============================================
  Files            320      320              
  Lines          67419    67941     +522     
=============================================
+ Hits           45275    45797     +522     
  Misses         22144    22144              
Flag Coverage Δ
core 75.21% <ø> (ø)
ffi 36.25% <ø> (+0.12%) ⬆️
rpc 19.92% <ø> (ø)
spv 83.76% <ø> (-0.17%) ⬇️
wallet 67.59% <97.61%> (+1.00%) ⬆️
Files with missing lines Coverage Δ
key-wallet-ffi/src/managed_account.rs 44.91% <ø> (-0.17%) ⬇️
key-wallet/src/account/mod.rs 62.79% <ø> (ø)
...y-wallet/src/managed_account/transaction_record.rs 100.00% <100.00%> (ø)
...src/transaction_checking/transaction_router/mod.rs 89.25% <ø> (ø)
...-wallet/src/transaction_checking/wallet_checker.rs 97.83% <99.74%> (+1.27%) ⬆️
key-wallet/src/managed_account/mod.rs 55.07% <92.85%> (+4.80%) ⬆️
...wallet/src/transaction_checking/account_checker.rs 66.45% <74.07%> (+2.44%) ⬆️

... and 9 files with indirect coverage changes

coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 31, 2026
Base automatically changed from refactor/store-transaction-context-in-transaction-record to v0.42-dev April 1, 2026 02:22
@xdustinface
xdustinface dismissed coderabbitai[bot]’s stale review April 1, 2026 02:22

The base branch was changed.

@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label Apr 1, 2026
@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

Add `InputDetail`, `OutputDetail`, `OutputRole`, and `TransactionDirection`
to capture which inputs/outputs are wallet-relevant and classify the
transaction direction at recording time.
@xdustinface
xdustinface force-pushed the feat/transaction-record-details branch from 6cc4bdc to b77532c Compare April 1, 2026 03:56
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Apr 1, 2026
@xdustinface
xdustinface marked this pull request as ready for review April 1, 2026 04:30
@github-actions github-actions Bot added the ready-for-review CodeRabbit has approved this PR label Apr 1, 2026

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@QuantumExplorer
QuantumExplorer merged commit b5cc235 into v0.42-dev Apr 1, 2026
42 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/transaction-record-details branch April 1, 2026 07:04
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