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

sweepbatcher: add mode with presigned transactions and CPFP #888

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

starius
Copy link
Collaborator

@starius starius commented Feb 21, 2025

In this mode sweepbatcher uses transactions provided by the CPFP helper, which may be pre-signed and not replace-by-fee (RBF) compatible. In such cases, CPFP may be necessary.

A single Batcher instance can handle both CPFP and regular batches. Currently CPFP and non-CPFP sweeps never appear in the same batch.

Pull Request Checklist

  • Update release_notes.md if your PR contains major features, breaking changes or bugfixes

@starius starius force-pushed the cpfp2 branch 2 times, most recently from 2339427 to d452a43 Compare February 21, 2025 19:02
@starius starius marked this pull request as ready for review February 21, 2025 19:13
@starius starius force-pushed the cpfp2 branch 3 times, most recently from 30c9a8f to ba7c1d4 Compare February 24, 2025 19:59
@starius starius marked this pull request as draft February 25, 2025 16:01
It should use the c variable passed into the lambda, not the parent t.
It should use assert, not require package.
Previously, if a completed batch was visited after a batch to which the
sweep was added, it was not deleted because the function returned early.

This has been separated into two loops: the first one removes completed batches,
and the second one adds the sweep to a batch.
This is needed to fix crashes in unit tests under -race.
Several structures were accessed without protection causing crashes under -race.
The code inside require.Eventually runs in parallel with the event loops
of the batcher and its batches. Accessing fields of the batcher and batches
must be done within an event loop.

To address this, testRunInEventLoop methods were added to the Batcher and batch
types. Unit tests were then rewritten to use this approach when accessing
batcher and batch fields.

Additionally, in many cases, receive operations from RegisterSpendChannel
were moved before require.Eventually. This prevents testRunInEventLoop from
getting stuck in an event loop while blocked on a RegisterSpendChannel send
operation.
In this mode sweepbatcher uses transactions provided by the CPFP helper, which
may be pre-signed and not replace-by-fee (RBF) compatible. In such cases, CPFP
may be necessary.

A single Batcher instance can handle both CPFP and regular batches. Currently
CPFP and non-CPFP sweeps never appear in the same batch.
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