Skip to content

[GEN-1599] Withdrawals to support the new Database model (single output backwards-compatible)#414

Merged
Jossec101 merged 16 commits into
mainfrom
multiple-outputs-withdrawals
Jun 13, 2025
Merged

[GEN-1599] Withdrawals to support the new Database model (single output backwards-compatible)#414
Jossec101 merged 16 commits into
mainfrom
multiple-outputs-withdrawals

Conversation

@Jossec101

@Jossec101 Jossec101 commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

The goal of this PR is to

  • Drop Legacy amount and dest for withdrawals safely
  • Adapt the UI to maintain single-output behaviour as frontend multi-output is out of scope
  • A coming PR will adapt the API to serve multi-output withdrawals
Screen.Recording.2025-06-12.at.14.13.01.mov

Jossec101 added 10 commits June 11, 2025 16:34
- Implemented migration to transfer existing data from WalletWithdrawalRequests to WalletWithdrawalRequestDestinations.
- Added verification step to ensure data integrity during migration.
… amount in a list of withdrawal request destinations
@Jossec101 Jossec101 changed the title Multiple outputs withdrawals Withdrawals to support the new Database model (single output) Jun 12, 2025
var balanceResponse = await _nbXplorerService.GetBalanceAsync(derivationStrategy);

walletWithdrawalRequest.Amount = ((Money)balanceResponse.Confirmed).ToUnit(MoneyUnit.BTC);
var firstDestination = walletWithdrawalRequest.WalletWithdrawalRequestDestinations?.FirstOrDefault();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is just for this version incoming versions will support multiple outputs.

@Jossec101 Jossec101 requested review from RodriFS and Copilot June 12, 2025 12:17
@Jossec101 Jossec101 marked this pull request as ready for review June 12, 2025 12:17

This comment was marked as outdated.

@Jossec101 Jossec101 requested a review from markettes June 12, 2025 12:21
@Jossec101 Jossec101 requested a review from Copilot June 12, 2025 13:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors withdrawal-related functionality for a new Database model by removing legacy properties and updating tests, UI elements, and service/repository logic to work with a single-output withdrawal approach. Key changes include replacing Amount/DestinationAddress with WalletWithdrawalRequestDestinations, updating data migrations to handle legacy data, and modifying UI and service logic to use the new destination model.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/NodeGuard.Tests/Services/BitcoinServiceTests.cs Updated tests to verify new destination list usage
test/NodeGuard.Tests/Data/Repositories/FUTXORepositoryTests.cs Refactored tests to use the new destination property
src/Shared/PSBTSign.razor Changed to display TotalAmount instead of Amount
src/Services/BitcoinService.cs Refactored amount assignment and destination tracking logic
src/Rpc/NodeGuardService.cs Updated withdrawal request creation using new array initializer syntax for destinations
src/Pages/Withdrawals.razor, src/Pages/Wallets.razor Modified UI components to support the destination list and TotalAmount changes
src/Migrations/* Added migrations for dropping obsolete fields and migrating legacy data
src/Data/* Updated models, repositories and DbInitializer to reflect the new withdrawal model
Comments suppressed due to low confidence (2)

src/Rpc/NodeGuardService.cs:225

  • [nitpick] Consider adding an inline comment explaining the new array initializer syntax for WalletWithdrawalRequestDestinations to aid maintainability for team members less familiar with C# 12 features.
WalletWithdrawalRequestDestinations = [

src/Migrations/20250611142943_MigrateLegacyWithdrawalData.cs:29

  • [nitpick] Verify that the use of a raw SQL transaction block with DO $$ in this migration is compatible with all target database systems and add a comment explaining its purpose for clarity.
DO $$

Comment thread src/Services/BitcoinService.cs
@Jossec101 Jossec101 changed the title Withdrawals to support the new Database model (single output) [GEN-1599] Withdrawals to support the new Database model (single output) Jun 12, 2025
@Jossec101 Jossec101 changed the title [GEN-1599] Withdrawals to support the new Database model (single output) [GEN-1599] Withdrawals to support the new Database model (single output backwards-compatible) Jun 12, 2025
markettes
markettes previously approved these changes Jun 13, 2025
Comment thread src/Data/DbInitializer.cs Outdated
Comment thread src/Migrations/20250611142943_MigrateLegacyWithdrawalData.cs Outdated
Comment thread src/Pages/Withdrawals.razor
Comment thread src/Services/BitcoinService.cs Outdated
Jossec101 and others added 2 commits June 13, 2025 16:59
@Jossec101 Jossec101 merged commit f88f891 into main Jun 13, 2025
5 checks passed
@Jossec101 Jossec101 deleted the multiple-outputs-withdrawals branch June 13, 2025 15:04
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.

4 participants