forked from lightningnetwork/lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
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
[2/3]: implement blockbeat
#9
Open
yyforyongyu
wants to merge
42
commits into
master
Choose a base branch
from
yy-blockbeat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull reviewers statsStats of the last 30 days for lnd:
|
yyforyongyu
force-pushed
the
yy-blockbeat
branch
from
June 17, 2024 13:18
bf1a621
to
06b5175
Compare
yyforyongyu
force-pushed
the
yy-prepare-blockbeat
branch
from
June 20, 2024 13:43
8242ffd
to
bc13d54
Compare
yyforyongyu
force-pushed
the
yy-blockbeat
branch
3 times, most recently
from
June 21, 2024 10:05
3592aa1
to
7df2d94
Compare
Pull Request Test Coverage Report for Build 9611908009Details
💛 - Coveralls |
yyforyongyu
force-pushed
the
yy-blockbeat
branch
from
June 24, 2024 13:40
7df2d94
to
f1648f6
Compare
yyforyongyu
force-pushed
the
yy-prepare-blockbeat
branch
from
June 24, 2024 13:59
bc13d54
to
01b173c
Compare
yyforyongyu
force-pushed
the
yy-blockbeat
branch
from
June 24, 2024 14:03
f1648f6
to
ba41ee4
Compare
Pull Request Test Coverage Report for Build 9646782258Details
💛 - Coveralls |
yyforyongyu
force-pushed
the
yy-prepare-blockbeat
branch
from
June 25, 2024 13:13
01b173c
to
9224414
Compare
yyforyongyu
force-pushed
the
yy-blockbeat
branch
from
June 25, 2024 13:13
ba41ee4
to
7be7745
Compare
yyforyongyu
force-pushed
the
yy-prepare-blockbeat
branch
from
June 27, 2024 01:29
9224414
to
3b91244
Compare
yyforyongyu
force-pushed
the
yy-blockbeat
branch
2 times, most recently
from
June 27, 2024 13:47
6f652ac
to
e65366e
Compare
yyforyongyu
force-pushed
the
yy-prepare-blockbeat
branch
from
June 27, 2024 18:23
3b91244
to
fb67045
Compare
yyforyongyu
force-pushed
the
yy-blockbeat
branch
from
June 27, 2024 19:57
e65366e
to
74cda6e
Compare
Pull Request Test Coverage Report for Build 9702800783Details
💛 - Coveralls |
yyforyongyu
force-pushed
the
yy-blockbeat
branch
3 times, most recently
from
June 29, 2024 02:18
040d363
to
651886f
Compare
Pull Request Test Coverage Report for Build 9720833654Details
💛 - Coveralls |
yyforyongyu
force-pushed
the
yy-blockbeat
branch
2 times, most recently
from
July 1, 2024 06:32
c5d5f0d
to
d7ffa05
Compare
Pull Request Test Coverage Report for Build 9739338901Details
💛 - Coveralls |
yyforyongyu
force-pushed
the
yy-prepare-blockbeat
branch
from
July 2, 2024 11:21
fb67045
to
799f05b
Compare
yyforyongyu
force-pushed
the
yy-prepare-blockbeat
branch
from
July 4, 2024 12:11
799f05b
to
a0393a0
Compare
This prepares the following commit where we now let the fee bumpr decides whether to broadcast immediately or not.
This commit changes how inputs are handled upon receiving a bump result. Previously the inputs are taken from the `BumpResult.Tx`, which is now instead being handled locally as we will remember the input set when sending the bump request, and handle this input set when a result is received.
This commit adds a new method `handleInitialBroadcast` to handle the initial broadcast. Previously we'd broadcast immediately inside `Broadcast`, which soon will not work after the `blockbeat` is implemented as the action to publish is now always triggered by a new block. Meanwhile, we still keep the option to bypass the block trigger so users can broadcast immediately by setting `Immediate` to true.
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.
With the combination of the following commit we can have a more granular control over the bump result when handling it in the sweeper.
After previous commit, it should be clear that the tx may be failed to created in a `TxFailed` event. We now make sure to catch it to avoid panic.
This commit inits the package `chainio` and defines the interface `Blockbeat` and `Consumer`. The `Consumer` must be implemented by other subsystems if it requires block epoch subscription.
In this commit, a minimal implementation 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 adds two methods to handle dispatching beats. These are exported methods so other systems can send beats to their managed subinstances.
This commit adds a blockbeat dispatcher which handles sending new blocks to all subscribed consumers.
This commit implements `Consumer` on `TxPublisher`, `UtxoSweeper`, `ChainArbitrator` and `ChannelArbitrator`.
This commit removes the independent block subscriptions in `UtxoSweeper` and `TxPublisher`. These subsystems now listen to the `BlockbeatChan` for new blocks.
This commit removes the hack introduced in lightningnetwork#4851. Previously we had this issue because the chain notifier was stopped before the sweeper, which was changed a while back and we now always stop the chain notifier last. In addition, since we no longer subscribe to the block epoch chan directly, this issue can no longer happen.
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 replaced them with the blockbeat managed by `BlockbeatDispatcher`.
This commit removes the block subscriptions used in `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.
To avoid calling GetBestBlock again.
This is needed so the consumers have an initial state about the current block.
In this commit we start to break up the starting process into smaller pieces, which is needed in the following commit to initialize blockbeat consumers.
Refactor the `Start` method to fix the linter error: ``` contractcourt/chain_arbitrator.go:568: Function 'Start' is too long (242 > 200) (funlen) ```
yyforyongyu
force-pushed
the
yy-blockbeat
branch
from
November 21, 2024 12:48
e59ce62
to
1e17c5c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a minimal version of the new service
Blockbeat
as described in lightningnetwork#7952, to handle block syncronization among different subsystems.During startup, blockbeat consumers are registered in the
BlockbeatDispatcher
, a subservice that's responsible for dispatching new blockbeats to its consumers and waiting for its consumers to finish processing the blocks. If any of the consumers failed to process the block under 30s, or encountered an error during block processing, the system will shut down as it's critical to handle blocks.This PR focuses on implementing blockbeat
Consumer
interface forChainArb
,UtxoSweeper
andTxPublisher
, the following PR focuses on finalizing blockbeat processing inChainArb
's subservices -ChannelArbitrator
,chainWatcher
, andContractResolver
.Overview
The flow of the blockbeat process is shown below, whenever a new block is arrived, it goes through the waterfall like this,
blockbeat
, and sends it to its consumers sequentially.ChainArb
receives the blockbeat, processes it and signals back when done.UtxoSweeper
receives the blockbeat, processes it and signals back when done.TxPublisher
receives the blockbeat, processes it and signals back when done.NOTE: itests are failing in this PR and is fixed in the final PR.
TODO