Commit Graph

18320 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
d18f32ebe7 lnwire: add feature bits for new rbf coop close 2025-02-28 15:36:01 -08:00
Oliver Gugger
e3d9fcb5ac Merge pull request #9549 from yyforyongyu/fix-bitcond-test
Fix unit test flake `TestHistoricalConfDetailsTxIndex`
2025-02-26 07:23:30 -06:00
yyforyongyu
cfa4341740 routing: fix flake in TestFilteredChainView/bitcoind_polling 2025-02-26 19:51:53 +08:00
yyforyongyu
56fa3aae34 routing/chainview: refactor TestFilteredChainView
So each test has its own miner and chainView.
2025-02-26 19:51:53 +08:00
yyforyongyu
4bfcfea2ee lntest+chainntnfs: make sure bitcoind node is synced
This commit makes sure the bitcoind node is synced to the miner when
initialized and returned from `NewBitcoindBackend`.
2025-02-26 19:51:52 +08:00
yyforyongyu
99d49dec6a multi: change NewBitcoindBackend to take a miner as its param
Prepares for the following commit where we assert the chain backend is
synced to the miner.
2025-02-26 19:51:52 +08:00
yyforyongyu
c725ba9f25 docs: update release notes re flake fix 2025-02-26 19:51:52 +08:00
yyforyongyu
1618d2c789 chainntnfs+lntest: fix sync to miner block flake
In this commit we document an unexpected behavior found when connecting
a bitcoind node to a btcd node. We mitigate this in our test by
reconnecting the nodes when the connection is broken. We also limit the
connection made from `bitcoind` to be v1 only.
2025-02-26 19:51:52 +08:00
yyforyongyu
175301628f lntest/unittest: make sure miner is connected to bitcoind
We change how the `bitcoind` node connects to the miner by creating a
temp RPC client and use it to connect to the miner. In addition we also
assert the connection is made.
2025-02-25 21:11:26 +08:00
yyforyongyu
245ea85894 lntest/unittest: assert bitcoind is shut down
Make sure the shutdown of `bitcoind` is finished without any errors.
2025-02-25 21:11:25 +08:00
yyforyongyu
7666d62a43 lntest/unittest: update config for miner and bitcoind
The config used for the miner is updated to skip banning and debug. For
bitcoind, the config is updated to use a unique port for P2P conn.
2025-02-25 21:10:40 +08:00
yyforyongyu
fa8527af09 Makefile+scripts: add unit test flake hunter
This commit adds a script to hunt flakes for a specific unit test with
trace logs. Also rename the make commands to make them more clear on
whether it's a unit test, itest, or paralleled itest.
2025-02-25 21:10:40 +08:00
Oliver Gugger
5d3680a6f6 Merge pull request #9484 from Abdulkbk/refactor-makedir
lnutils: add CreateDir util function
2025-02-25 01:00:45 -06:00
Oliver Gugger
b8c5e85821 Merge pull request #8900 from guggero/go-cc
Makefile: add GOCC variable
2025-02-25 00:59:14 -06:00
Yong
fca9fae2d8 Merge pull request #9433 from hieblmi/estimate-route-fee-fix
routerrpc: fix estimateroutefee for public route hints
2025-02-25 13:58:43 +08:00
Slyghtning
f867954a68 docs: update release notes 2025-02-24 09:56:24 +01:00
Slyghtning
6399d77c18 routerrpc: fix estimateroutefee for public route hints 2025-02-24 09:56:22 +01:00
Oliver Gugger
ad021a290d Makefile: add GOCC variable 2025-02-23 09:48:54 +01:00
Oliver Gugger
5fe900d18d Merge pull request #9534 from ellemouton/graph13
graph: refactor Builder network message handling
2025-02-21 08:38:35 -06:00
Elle Mouton
c89b616e7d graph: refactor Builder network message handling
The exposed AddNode, AddEdge and UpdateEdge methods of the Builder are
currently synchronous since even though they pass messages to the
network handler which spins off the handling in a goroutine, the public
methods still wait for a response from the handling before returning.
The only part that is actually done asynchronously is the topology
notifications.

We previously tried to simplify things in [this
commit](d757b3bcfc)
but we soon realised that there was a reason for sending the messages to
the central/synchronous network handler first: it was to ensure
consistency for topology clients: ie, the ordering between when there is
a new topology client or if it is cancelled needs to be consistent and
handled synchronously with new network updates. So for example, if a new
update comes in right after a topology client cancels its subscription,
then it should _not_ be notified. Similariy for new subscriptions. So
this commit was reverted soon after.

We can, however, still simplify things as is done in this commit by
noting that _only topology subscriptions and notifications_ need to be
handled separately. The actual network updates do not need to. So that
is what is done here.

This refactor will make moving the topology subscription logic to a new
subsystem later on much easier.
2025-02-21 10:39:00 -03:00
Oliver Gugger
1227eb1cce Merge pull request #9491 from ziggie1984/closechannel-rpc
Allow coop closing a channel with HTLCs on it via lncli
2025-02-21 05:05:53 -06:00
Olaoluwa Osuntokun
27440e8957 Merge pull request #9535 from guggero/remove-caching
GitHub: remove duplicate caching
2025-02-20 16:57:55 -08:00
Olaoluwa Osuntokun
553899bffb Merge pull request #9447 from yyforyongyu/yy-sweeper-fix
sweep: start tracking input spending status in the fee bumper
2025-02-20 16:56:45 -08:00
Oliver Gugger
dc64ea97a2 GitHub: remove duplicate caching
Turns out that actions/setup-go starting with @v4 also adds caching.
With that, our cache size on disk has almost doubled, leading to the
GitHub runner running out of space in certain situation.
We fix that by disabling the automated caching since we already have our
own, custom-tailored version.
2025-02-20 18:14:29 +01:00
ziggie
8017139df5 docs: add release-notes 2025-02-20 17:43:18 +01:00
ziggie
f994c2cb9f htlcswitch: fix log output 2025-02-20 17:43:18 +01:00
ziggie
f458844412 lnd: add max fee rate check to closechannel rpc 2025-02-20 17:43:18 +01:00
ziggie
59443faa36 multi: coop close with active HTLCs on the channel
For the lncli cmd we now always initiate the coop close even if
there are active HTLCs on the channel. In case HTLCs are on the
channel and the coop close is initiated LND handles the closing
flow in the background and the lncli cmd will block until the
transaction is broadcasted to the mempool. In the background LND
disallows any new HTLCs and waits until all HTLCs are resolved
before kicking of the negotiation process.
Moreover if active HTLCs are present and the no_wait param is not
set the error msg is now highlightning it so the user can react
accordingly.
2025-02-20 17:43:18 +01:00
Abdullahi Yunus
45a913ee91 lnutils: add createdir util function
This utility function replaces repetitive logic patterns
throughout LND.
2025-02-20 17:08:21 +01:00
Oliver Gugger
09a4d7e224 Merge pull request #9530 from ziggie1984/fix-debug-log
multi: fix debug log
2025-02-20 09:28:14 -06:00
yyforyongyu
9f7e2bfd96 contractcourt: fix errorlint 2025-02-20 23:14:12 +08:00
ziggie
9382fcb801 multi: fix debug log 2025-02-20 10:44:19 +01:00
yyforyongyu
7ab0e15937 sweep: fix error logging 2025-02-20 14:41:52 +08:00
yyforyongyu
353f208031 sweep: refactor IsOurTx to not return an error
Before this commit, the only error returned from `IsOurTx` is when the
root bucket was not created. In that case, we should consider the tx to
be not found in our db, since technically our db is empty.

A future PR may consider treating our wallet as the single source of
truth and query the wallet instead to check for past sweeping txns.
2025-02-20 14:41:52 +08:00
yyforyongyu
8d49246a54 docs: add release notes 2025-02-20 14:41:50 +08:00
yyforyongyu
c61f781be7 itest: split up force close tests
So we can focus on testing normal flow vs persistence flow.
2025-02-20 14:40:54 +08:00
yyforyongyu
74161f0d57 sweep: make sure recovered inputs are retried
Previously, when a given input is found spent in the mempool, we'd mark
it as Published and never offer it to the fee bumper. This is dangerous
as the input will never be fee bumped. We now fix it by always
initializing the input with state Init, and only use mempool to check
for fee and fee rate.

This changes the current restart behavior - as previously when a
sweeping tx is broadcast, the node shuts down, when it starts again, the
input will be offered to the sweeper again, but not to the fee bumper,
which means the sweeping tx will stay in the mempool with the last-tried
fee rate. After this change, after a restart, the input will be swept
again, and the fee bumper will monitor its status. The restart will also
behave like a fee bump if there's already an existing sweeping tx in the
mempool.
2025-02-20 14:40:54 +08:00
yyforyongyu
4bd1a344b9 sweep: signal tx in markInputFatal
This commit adds the failed tx to the result when marking the input as
fatal, which is used in the commit resolver when handling revoked
outputs.
2025-02-20 14:40:54 +08:00
yyforyongyu
b184afe227 sweep: handle missing inputs during fee bumping
This commit handles the case when the input is missing during the RBF
process, which could happen when the bumped tx has inputs being spent by
a third party. Normally we should be able to catch the spend early via
the spending notification and never attempt to fee bump the record.
However, due to the possible race between block notification and spend
notification, this cannot be guaranteed. Thus, we need to handle the
case during the RBF when seeing a `ErrMissingInputs`, which can only
happen when the inputs are spent by others.
2025-02-20 14:40:53 +08:00
yyforyongyu
4f469de18e sweep: refactor handleInitialTxError and createAndCheckTx
This commit refactors `handleInitialTxError` and `createAndCheckTx` to
take a `monitorRecord` param, which prepares for the following commit
where we start handling missing inputs.
2025-02-20 14:40:53 +08:00
yyforyongyu
f614e7aed9 sweep: add createUnknownSpentBumpResult
A minor refactor to break the method `handleUnknownSpent` into two
steps, which prepares the following commit where we start handling
missing inputs.
2025-02-20 14:40:53 +08:00
yyforyongyu
db8319d70b sweep: add method handleReplacementTxError
This is a minor refactor so the `createAndPublishTx` flow becomes more
clear, also prepares for the following commit where we start to handle
missing inputs.
2025-02-20 14:40:53 +08:00
yyforyongyu
42818949dc sweep: retry sweeping inputs upon TxUnknownSpend
We now start handling `TxUnknownSpend` in our sweeper to make sure the
failed inputs are retried when possible.
2025-02-20 14:40:53 +08:00
yyforyongyu
2f1205a394 sweep: start tracking inputs spent by unknown tx
This commit adds a new field `InputsSpent` to the `BumpResult` so they
can be used to track inputs spent by txns not recoginized by the fee
bumper.
2025-02-20 14:40:53 +08:00
yyforyongyu
388183e173 itest: add fee replacement test 2025-02-20 14:40:52 +08:00
yyforyongyu
db351e1908 sweep: rename methods for clarity
We now rename "third party" to "unknown" as the inputs can be spent via
an older sweeping tx, a third party (anchor), or a remote party (pin).
In fee bumper we don't have the info to distinguish the above cases, and
leave them to be further handled by the sweeper as it has more context.
2025-02-20 14:40:52 +08:00
yyforyongyu
121116cff7 sweep: remove dead code and add better logging 2025-02-20 14:40:52 +08:00
yyforyongyu
50bc191feb sweep: handle unknown spent in processRecords
This commit refactors the `processRecords` to always handle the inputs
spent when processing the records. We now make sure to handle unknown
spends for all backends (previously only neutrino), and rely solely on
the spending notification to give us the onchain status of inputs.
2025-02-20 14:40:52 +08:00
yyforyongyu
61cec43951 sweep: add a new event TxUnknownSpend 2025-02-20 14:40:52 +08:00
yyforyongyu
8c9ba327cc sweep: add method getSpentInputs
To track the input and its spending tx, which will be used later to
detect unknown spends.
2025-02-20 14:40:52 +08:00