Commit Graph
17911 Commits
Author SHA1 Message Date
yyforyongyu 8fc9154506 lnd: start blockbeatDispatcher and register consumers 2024-12-20 17:54:03 +08:00
yyforyongyu 16a8b623b3 lnd: add new method startLowLevelServices
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.
2024-12-20 17:54:02 +08:00
yyforyongyu 545cea0546 multi: start consumers with a starting blockbeat
This is needed so the consumers have an initial state about the current
block.
2024-12-20 17:54:02 +08:00
yyforyongyu 802353036e contractcourt: start channel arbitrator with blockbeat
To avoid calling GetBestBlock again.
2024-12-20 17:54:02 +08:00
yyforyongyu e2e59bd90c contractcourt: remove the immediate param used in Resolve
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.
2024-12-20 17:54:02 +08:00
yyforyongyu 71295534bb contractcourt: remove block subscription in channel arbitrator
This commit removes the block subscriptions used in `ChannelArbitrator`,
replaced them with the blockbeat managed by `BlockbeatDispatcher`.
2024-12-20 17:54:02 +08:00
yyforyongyu 045f8432b7 contractcourt: remove block subscription in chain arbitrator
This commit removes the block subscriptions used in `ChainArbitrator`
and replaced them with the blockbeat managed by `BlockbeatDispatcher`.
2024-12-20 17:54:02 +08:00
yyforyongyu 5f9d473702 contractcourt: remove waitForHeight in resolvers
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.
2024-12-20 17:54:02 +08:00
yyforyongyu 3ac6752a77 sweep: remove redundant notifications during shutdown
This commit removes the hack introduced in #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.
2024-12-20 17:54:01 +08:00
yyforyongyu e113f39d26 sweep: remove block subscription in UtxoSweeper and TxPublisher
This commit removes the independent block subscriptions in `UtxoSweeper`
and `TxPublisher`. These subsystems now listen to the `BlockbeatChan`
for new blocks.
2024-12-20 17:54:01 +08:00
yyforyongyu 801fd6b85b multi: implement Consumer on subsystems
This commit implements `Consumer` on `TxPublisher`, `UtxoSweeper`,
`ChainArbitrator` and `ChannelArbitrator`.
2024-12-20 17:54:01 +08:00
yyforyongyu b5a3a27c77 chainio: add partial implementation of Consumer interface 2024-12-20 17:54:01 +08:00
yyforyongyu 4b83d87baa chainio: add BlockbeatDispatcher to dispatch blockbeats
This commit adds a blockbeat dispatcher which handles sending new blocks
to all subscribed consumers.
2024-12-20 17:54:01 +08:00
yyforyongyu a1eb87e280 chainio: add helper methods to dispatch beats
This commit adds two methods to handle dispatching beats. These are
exported methods so other systems can send beats to their managed
subinstances.
2024-12-20 17:54:01 +08:00
yyforyongyu 01ac713aec chainio: implement Blockbeat
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.
2024-12-20 17:54:00 +08:00
yyforyongyu 060ff013c1 chainio: introduce chainio to handle block synchronization
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.
2024-12-20 17:54:00 +08:00
yyforyongyu 30ee450091 sweep: make sure nil tx is handled
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.
2024-12-20 17:54:00 +08:00
yyforyongyu 78ce757e7b sweep: break initialBroadcast into two steps
With the combination of the following commit we can have a more granular
control over the bump result when handling it in the sweeper.
2024-12-20 17:54:00 +08:00
yyforyongyu f0c4e6dba1 sweep: remove redundant loopvar assign 2024-12-20 17:54:00 +08:00
yyforyongyu 7545bbfa92 sweep: make sure defaultDeadline is derived from the mature height 2024-12-20 17:54:00 +08:00
yyforyongyu afc08c6623 sweep: add method isMature on SweeperInput
Also updated `handlePendingSweepsReq` to skip immature inputs so the
returned results are the same as those in pre-0.18.0.
2024-12-20 17:53:59 +08:00
yyforyongyu ba238962d6 sweep: add method handleBumpEventError and fix markInputFailed
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.
2024-12-20 17:53:59 +08:00
yyforyongyu 719ca5b229 sweep: remove redundant error from Broadcast 2024-12-20 17:53:59 +08:00
yyforyongyu 77ff2c0585 sweep: add handleInitialBroadcast to handle initial broadcast
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.
2024-12-20 17:53:59 +08:00
yyforyongyu 2479dc7f2e sweep: handle inputs locally instead of relying on the tx
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.
2024-12-20 17:53:59 +08:00
yyforyongyu d0c7fd8aac sweep: add new interface method Immediate
This prepares the following commit where we now let the fee bumpr
decides whether to broadcast immediately or not.
2024-12-20 17:53:59 +08:00
yyforyongyu 5f64280df4 sweep: add new error ErrZeroFeeRateDelta 2024-12-20 17:53:59 +08:00
yyforyongyu 6c2e8b9a00 sweep: add new state TxFatal for erroneous sweepings
Also updated the loggings. This new state will be used in the following
commit.
2024-12-20 17:53:58 +08:00
Oliver Gugger 1dfb5a0c20 Merge pull request #9382 from guggero/linter-update
lint: deprecate old linters, use new ref commit
2024-12-20 10:51:08 +01:00
Oliver Gugger f3ddf4d8ea .golangci.yml: speed up linter by updating start commit
With this we allow the linter to only look at recent changes, since
everything between that old commit and this most recent one has been
linted correctly anyway.
2024-12-20 10:02:24 +01:00
Oliver Gugger ad29096aa1 .golangci.yml: turn off deprecated linters
All these linters produced a deprecation warning. They've all been
replaced by new linters, so we can safely turn them off.
2024-12-20 10:01:42 +01:00
Oliver Gugger 03eab4db64 Merge pull request #9377 from alingse/fix-nilnesserr
fix check node1Err !=nil but return a nil value error err
2024-12-20 09:26:38 +01:00
Oliver Gugger fd4531c751 Merge pull request #9379 from ziggie1984/release-doc-fix
Correct release notes for 18.4 and 19.0
2024-12-19 20:14:16 +01:00
ziggie 90db546b64 docs: update release-notes
Correct 18.4 release-notes for a change which will only be part
of 19.0.
2024-12-19 18:58:13 +01:00
alingse a79fd08294 fix check node1Err !=nil but return a nil value error err
Signed-off-by: alingse <alingse@foxmail.com>
2024-12-19 14:57:28 +00:00
Oliver Gugger 2d629174e7 Merge pull request #9376 from yyforyongyu/remove-replace
gomod: remove replaces of `kvdb` and `sqldb`
2024-12-19 13:27:27 +01:00
yyforyongyu 785cef2a96 gomod: remove replace of sqldb and kvdb 2024-12-19 19:02:46 +08:00
Oliver Gugger 29a37d34d1 Merge pull request #9242 from aakselrod/reapply-8644
Reapply #8644
2024-12-19 08:31:59 +01:00
Oliver Gugger 7544a2b232 Merge pull request #9319 from thirdkeyword/master
chore: fix some problematic method name in comment
2024-12-19 08:30:39 +01:00
Oliver Gugger dac4c1f2d3 Merge pull request #9374 from Crypt-iQ/fn_set_copy
fn: add set copy method Copy
2024-12-19 08:29:02 +01:00
thirdkeyword 4c844bfb77 chore: fix some problematic method name in comment
Signed-off-by: thirdkeyword <fliterdashen@gmail.com>
2024-12-19 13:57:07 +08:00
Eugene Siegel 6fb8269c84 fn: add set copy method Copy 2024-12-18 15:17:23 -05:00
Alex Akselrod c9d217b144 docs: update release-notes for 0.19.0 2024-12-18 10:13:21 -08:00
Olaoluwa Osuntokun 8ecef03315 Merge pull request #9303 from yyforyongyu/fix-circuit-closed
htlcswitch+routing: handle nil pointer dereference properly
2024-12-17 12:19:32 +01:00
Oliver Gugger 729cd22bf6 Merge pull request #8914 from z017/master
fn: add synchronous write file
2024-12-16 18:39:52 +01:00
0652cbd4a1 fn: add synchronous write file
The fn.WriteFile writes data like os.WriteFile but in sync mode.
Also adds a behaviour flag that enables removal of file on error.

Co-authored-by: Maurice Poirrier Chuden <mauricepoirrier@gmail.com>
Co-authored-by: Greg Weber <1183+gregwebs@users.noreply.github.com>
2024-12-16 11:16:00 -03:00
Oliver Gugger 522bb82755 Merge pull request #9357 from GeorgeTsagk/onchain-htlc-replay-wire-records
contractcourt: include custom records on replayed htlc
2024-12-16 12:50:04 +01:00
George Tsagkarelis 231dd6b464 contractcourt: include custom records on replayed htlc
When notifying the invoice registry for an exit hop htlc we also want to
include its custom records. The channelLink, the other caller of this
method, already populates this field. So we make sure the contest
resolver does so too.
2024-12-16 10:29:27 +01:00
yyforyongyu 7882e1ccff lnwallet: add debug logs 2024-12-16 16:07:22 +08:00
yyforyongyu 39584be7e1 routing: fix nil pointer dereference in exitWithErr
In a rare case when the critical log is triggered when using postgres as
db backend, the `payment` could be nil cause the server is shutting
down, causing the payment fetching to return an error. We now cache its
state before fetching it from the db.
2024-12-16 16:07:22 +08:00