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

Introduce blockbeat - implement Consumer on resolvers #8

Open
wants to merge 31 commits into
base: yy-prepare-blockbeat
Choose a base branch
from

Conversation

yyforyongyu
Copy link
Owner

@yyforyongyu yyforyongyu commented Jun 5, 2024

An alternative approach where all the resolvers implement the Consumer interface, starting at this commit 9cdbd5b.

Copy link

github-actions bot commented Jun 5, 2024

Pull reviewers stats

Stats of the last 30 days for lnd:

User Total reviews Time to review Total comments

This commit moves the `HarnessMiner` into a new package to avoid
confusion about incoming changes.
This commit adds more assertion to `MineBlocks` so the caller won't
misuse it.
in harness

Prepare to make `HarnessTest.Miner` a private instance to sync height.
So the block data can be used by subsystems without calling `GetBlock`.
Also updated the loggings. This new state will be used in the following
commit.
This commit adds a new method `handleInitialBroadcast` to handle the
initial broadcast. Previously we'd broadcast immediately inside
`Broadcast`, which soon will not work giving the blockbeat being used in
the following commit.
Previously in `markInputFailed`, we'd remove all inputs under the same
group via `removeExclusiveGroup`. This is wrong as when the current
sweep fails for this input, it shouldn't affect other inputs.
Also updated `handlePendingSweepsReq` to skip immature inputs so the
returned results are the same as those in pre-0.18.0.
This commit inits the package `chainio` and defines the interface
`Consumer`, which must be implemented by other subsystems if it requires
block epoch subscription.
In this commit, a minimal version of `Blockbeat` is added to synchronize
block heights, which will be used in `ChainArb`, `Sweeper`, and
`TxPublisher` so blocks are processed sequentially among them.
This commit implements `Consumer` on `TxPublisher`, `UtxoSweeper`,
`ChainArbitrator` and `ChannelArbitrator`. In addition, a
`BlockConsumer` is added to save code duplication.
This commit removes the independent block subscriptions in `UtxoSweeper`
and `TxPublisher`. These subsystems now listen to the `BlockbeatChan`
for new blocks.
The sweeper can handle the waiting so there's no need to wait for blocks
inside the resolvers. By offering the inputs prior to their mature
heights also guarantees the inputs with the same deadline are
aggregated.
This commit removes the block subscriptions used in `ChainArbitrator`
and `ChannelArbitrator`, replaced them with the blockbeat managed by
`BlockbeatDispatcher`.
This `immediate` flag was added as a hack so during a restart, the
pending resolvers would offer the inputs to the sweeper and ask it to
sweep them immediately. This is no longer need due to `blockbeat`, as
now during restart, a block is always sent to all subsystems via the
flow `ChainArb` -> `ChannelArb` -> resolvers -> sweeper. Thus, when
there are pending inputs offered, they will be processed by the sweeper
immediately.
@yyforyongyu yyforyongyu force-pushed the yy-prepare-blockbeat branch 2 times, most recently from 8242ffd to bc13d54 Compare June 20, 2024 13:43
@yyforyongyu yyforyongyu changed the title block beat Introduce blockbeat Jun 20, 2024
@yyforyongyu yyforyongyu changed the title Introduce blockbeat Introduce blockbeat - implement Consumer on resolvers Jun 20, 2024
@yyforyongyu yyforyongyu force-pushed the yy-prepare-blockbeat branch 4 times, most recently from 3b91244 to fb67045 Compare June 27, 2024 18:23
@yyforyongyu yyforyongyu force-pushed the yy-prepare-blockbeat branch 2 times, most recently from 799f05b to a0393a0 Compare July 4, 2024 12:11
@yyforyongyu yyforyongyu force-pushed the yy-prepare-blockbeat branch 4 times, most recently from 8b95551 to 9ec032a Compare July 18, 2024 07:27
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