Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wallet 2/3]: refactor funding logic to use allocation code #1407

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

guggero
Copy link
Member

@guggero guggero commented Feb 24, 2025

Refactors the wallet's funding code to use the pre-existing allocation logic to distribute coins from grouped assets.

Part of the group key support saga:

@guggero guggero added this to the v0.6 milestone Feb 24, 2025
@guggero guggero changed the title wallet: refactor funding logic to use allocation code [wallet]: refactor funding logic to use allocation code Feb 24, 2025
@coveralls
Copy link

coveralls commented Feb 24, 2025

Pull Request Test Coverage Report for Build 13571552842

Details

  • 239 of 391 (61.13%) changed or added relevant lines in 9 files are covered.
  • 66 unchanged lines in 12 files lost coverage.
  • Overall coverage increased (+0.009%) to 54.575%

Changes Missing Coverage Covered Lines Changed/Added Lines %
itest/assertions.go 17 22 77.27%
tapsend/allocation.go 148 159 93.08%
tapchannel/aux_sweeper.go 0 18 0.0%
tapchannel/aux_closer.go 0 20 0.0%
tapfreighter/fund.go 57 82 69.51%
tapchannel/aux_funding_controller.go 0 26 0.0%
tapchannel/commitment.go 7 54 12.96%
Files with Coverage Reduction New Missed Lines %
asset/group_key.go 2 72.65%
itest/multisig.go 3 97.43%
tapchannel/aux_leaf_signer.go 3 43.43%
tapfreighter/fund.go 3 73.02%
tappsbt/interface.go 3 80.28%
address/mock.go 4 86.93%
asset/mock.go 4 72.16%
tapgarden/caretaker.go 4 77.25%
asset/asset.go 6 79.84%
tapdb/multiverse.go 6 81.65%
Totals Coverage Status
Change from base Build 13571552705: 0.009%
Covered Lines: 49002
Relevant Lines: 89789

💛 - Coveralls

@guggero guggero force-pushed the allocation-refactor branch from 08b7805 to 941d26e Compare February 25, 2025 07:54
@guggero guggero requested review from Roasbeef and ffranr February 25, 2025 08:32
@guggero guggero marked this pull request as ready for review February 25, 2025 19:49
@guggero guggero changed the title [wallet]: refactor funding logic to use allocation code [wallet 2/3]: refactor funding logic to use allocation code Feb 26, 2025
@guggero guggero force-pushed the allocation-refactor branch from 941d26e to 06ea429 Compare February 26, 2025 15:12
@guggero guggero force-pushed the group-key-refactor branch 2 times, most recently from 8c3d631 to c28aacf Compare February 26, 2025 15:33
@guggero guggero force-pushed the allocation-refactor branch from 06ea429 to 8939b42 Compare February 26, 2025 15:33
@guggero guggero force-pushed the allocation-refactor branch from 8939b42 to ee66eb9 Compare February 26, 2025 15:43
We'll generalize the allocation code in future commits so we can re-use
it. We need to make sure we don't create circular package dependencies,
so we move the code to a more appropriate location.
The version of the virtual packet has an influence on the commitment
versions of the outputs created from it, so it's important that it can
be configured in a more generic use of the allocation code.
This is a preparatory commit that just re-structures the vOutput
creation a bit. This will make the actual changes in the next commit
more easy to understand.
This commit changes nothing in the behavior of the code.
The allocation code was previously only used for channel outputs, where
all virtual transactions are always interactive.
But we want to use the same code for non-interactive transfers as well,
which requires a couple of tweaks.
Because we'll need to convert a funding template that's potentially
given to us over the RPC interface into an allocation, we need to add
custom code for that.
With the new funding logic now potentially adding the change output
first, we need to make sure the channel funding logic doesn't use
hard-coded indexes.
We are now validating the input amount and types when creating the
allocations and no longer need this function.
@guggero guggero force-pushed the allocation-refactor branch from ee66eb9 to 86112a5 Compare February 27, 2025 16:48
@guggero guggero changed the base branch from group-key-refactor to main February 28, 2025 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants