Commit Graph

16058 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
185119f5c3
peer: refactor main event loop for ping handler
The error was never used as the init couldn't return an error, so we do
away with that. We also modify the main event loop dispatch to more
closely match other areas of the codebase.
2024-01-22 18:20:30 -08:00
Olaoluwa Osuntokun
b5cbeb4ad7
peer: make PingManager disconnect call async
In this commit, we make all calls to disconnect after a ping/pong
violation is detected in the `PingManager` async. We do this to avoid
circular waiting that may occur if the disconnect call back ends up
waiting on the peer goroutine to be torn down. If this happens, then the
peer goroutine will be blocked on the ping manager fully tearing down,
which is blocked on the peer disconnect succeeding.

This is a similar class of issue we've delt with recently as pertains to
the peer and the server: sync all back execution must not lead to
a circular waiting loop.

Fixes #8379
2024-01-22 18:20:23 -08:00
Keagan McClelland
ec55831229 htlcswitch+peer: remove ShutdownIfChannelClean 2024-01-22 16:08:59 -08:00
Keagan McClelland
64fda6ca65 htlcswitch: implement flush and commit lifecycle hooks for channelLink 2024-01-22 16:08:55 -08:00
Olaoluwa Osuntokun
41c167d37c
Merge pull request #8400 from ellemouton/deadlockFix
channeldb: acquire mutexes in the same order throughout
2024-01-22 12:57:48 -08:00
Keagan McClelland
601afaf1b2 htlcswitch: implement flush api for channelLink 2024-01-22 12:19:58 -08:00
Keagan McClelland
891b00d473 htlcswitch: drop the connection when receiving an invalid add
When the link is flushing in the incoming direction, it means
adds are invalid. The best chance we have at dealing with this
is to drop the connection. This should roll back the channel
state to the last CommitSig. If the remote has already sent a
CommitSig we haven't received yet, channel state will be
re-synchronized with a ChannelReestablish message upon
reconnection and the protocol state that caused us to flush
the link will be rolled back. In the event that there was some
non-deterministic behavior in the remote that caused them to
violate the protocol, we have a decent shot at correcting it
this way, since reconnecting will put us in the cleanest
possible state to try again.
2024-01-22 12:19:58 -08:00
Keagan McClelland
a9d5235c62 htlcswitch: bounce downstream adds when flushing 2024-01-22 12:19:58 -08:00
Keagan McClelland
5ab69aedc7 peer: remove tryLinkShutdown due to redundance
We don't need to try a link shutdown when the chan closer is fetched
since, by this commit, the only callsite manages the shutdown semantics.
After removing the call to tryLinkShutdown, we no longer need the
function at all.
2024-01-22 12:19:58 -08:00
Keagan McClelland
025e569f07 peer: fix local close requests to shutdown via link lifecycle hooks
In order to handle shutdown requests when there are still HTLCs on
the link, we have to manage the shutdown process via the link's
lifecycle hooks. This means we can't use the simple `tryLinkShutdown`
anymore and instead queue a `Shutdown` message at the next opportunity
to do so -- when we send our next `CommitSig`
2024-01-22 12:19:58 -08:00
Keagan McClelland
442f1dd677 peer: handle close messages using link lifecycle hooks 2024-01-22 12:19:58 -08:00
Keagan McClelland
70292253d1 htlcswitch: make link forward eligibility flush aware 2024-01-22 12:19:58 -08:00
Keagan McClelland
6955dc9f12 chancloser: remove ProcessCloseMsg 2024-01-22 12:19:58 -08:00
Keagan McClelland
704eb84bcb chancloser: rewrite tests in terms of new ChanCloser methods 2024-01-22 12:19:58 -08:00
Keagan McClelland
f81e7ada4c peer: rewrite handleCloseMsg in terms of new ChanCloser methods 2024-01-22 12:19:58 -08:00
Keagan McClelland
7b08899cdb chancloser: cache remote ClosingSigned to deal with race 2024-01-22 12:19:58 -08:00
Keagan McClelland
3aceeea4f3 chancloser: move nil MarkCoopBroadcasted to BeginNegotiation 2024-01-22 12:19:58 -08:00
Keagan McClelland
1b0f97a483 chancloser: move initFeeBaseline to BeginNegotiation 2024-01-22 12:19:58 -08:00
Keagan McClelland
45d30af273 chancloser: add BeginNegotiation method to bridge phases 2024-01-22 12:19:58 -08:00
Keagan McClelland
e77d3adef2 chancloser: extract ProcessCloseMsg ClosingSigned handling logic into dedicated method 2024-01-22 12:19:58 -08:00
Keagan McClelland
6fef9ea2d7 chancloser: extract ProcessCloseMsg Shutdown handling logic into dedicated method 2024-01-22 12:19:58 -08:00
Keagan McClelland
30ad49a29d chancloser: add new closeAwaitingFlushState 2024-01-22 12:19:58 -08:00
Keagan McClelland
9b2d1018f2 htlcswitch+peer: add flush api and lifecycle hooks to ChannelUpdateHandler
We also add dummy implementations to channelLink and various mocks.
2024-01-22 12:19:58 -08:00
Mohamed Awnallah
1402ffd17b
protolint: configure protolint and fix the protolinting issues
This PR addresses the following:
- Install and Configure protolint to enforce the protobuf style guide rules in the CI.
- Fix the protolinting issues (package and import ordering) while maintaining the comaptibility.
2024-01-22 22:00:00 +02:00
Elle Mouton
63a3882272
docs: add release note 2024-01-22 21:08:37 +02:00
Elle Mouton
6c427a6ba9
multi: update FetchChanInfos to take in an optional tx
In this commit, the FetchChanInfos ChannelGraph method is updated to
take in an optional read transaction for the case where it is called
from within another transaction.
2024-01-22 21:07:55 +02:00
Elle Mouton
8cf4044215
channeldb: rename delChannelEdge to delChannelEdgeUnsafe
In order to emphasise the fact that the ChannelGraph's cacheMu should be
acquired before calling the `delChannelEdge` method, we add the `Unsafe`
postfix and add a comment to alert readers.
2024-01-22 21:07:55 +02:00
Elle Mouton
ab06665fde
channeldb: acquire mutexes in the same order throughout
In this commit, we ensure that the channeldb cacheMu mutex is only ever
aquired _before_ acquiring the main DB lock in the cases where the two
locks need to be held simultaneously.

With this commit, the deadlock demonstrated in the previous commit is
now fixed.
2024-01-22 21:07:55 +02:00
Elle Mouton
76748bdbf7
channeldb: add ChannelGraph stress test
This commit adds a test that calls many of the ChannelGraph methods
concurrently and in a random order. This test demonstrates that a
deadlock currently exists in the ChannelGraph since the test does not
complete. This is fixed in the next commit.
2024-01-22 21:07:54 +02:00
Yong
ec5b824879
Merge pull request #8406 from ziggie1984/fix-channel-opening-issue
Fix case where Opening Channels get stuck forever.
2024-01-23 02:12:44 +08:00
ziggie
13e557d9b0
docs: add release-notes. 2024-01-22 16:45:39 +00:00
ziggie
ccac5c349c
multi: Add itest for a failed funding flow.
This adds an itest for a failed funding flow by our peer.
2024-01-22 16:45:38 +00:00
ziggie
3530254ff4
peer: add unit test.
Add a unit test for the removal of a pending channel.
2024-01-22 13:01:42 +00:00
ziggie
a5d2541292
funding: initialize remove channel. 2024-01-22 12:58:52 +00:00
Oliver Gugger
e1259cd3c7
Merge pull request #8411 from guggero/make-help
Makefile: add `make help` command that describes goals
2024-01-22 03:59:41 -06:00
Oliver Gugger
35fa053144
Merge pull request #8413 from ellemouton/add-0-17-4-release-notes
docs: add template for 0.17.4
2024-01-22 03:58:16 -06:00
Elle Mouton
2a237209d2
docs: add template for 0.17.4 2024-01-22 11:08:25 +02:00
Oliver Gugger
f35a3718ec
Makefile: add make help command that describes goals
This commit adds a description to each make goal that is printed when
`make help` is run.
Idea borrowed from btcsuite/btcd#2107.
2024-01-22 10:31:48 +02:00
Oliver Gugger
2b83ea309a
Merge pull request #8407 from mohamedawnallah/fix-typo-channel.go
fix: fix typo "(cltv_expiry" to "(cltv_expiry)" in `channeldb/channel.go` [skip ci]
2024-01-22 00:46:06 -06:00
Oliver Gugger
cc18ec4f55
Merge pull request #8354 from mohamedawnallah/add-bitcoind-docker-image-compose-setup
docker: setup `bitcoind` docker image in the `docker-compose.yml` file
2024-01-22 00:43:26 -06:00
Mohamed Awnallah
8407e6989e
fix: fix typo "(cltv_expiry" to "(cltv_expiry)" [skip ci] 2024-01-20 17:31:19 +02:00
Elle
0a29b37be6
Merge pull request #7733 from ellemouton/taprootTowers
watchtower: support taproot channel commitments
2024-01-19 22:55:20 +02:00
Oliver Gugger
24a79c78ed
Merge pull request #8403 from ellemouton/towerInterfaceGotcha
config: pass tower manager pointer in to PopulateDependencies
2024-01-19 07:59:30 -06:00
Mohamed Awnallah
a7914af264
docker: setup bitcoind docker image in the docker compose yaml file 2024-01-19 15:33:47 +02:00
Elle Mouton
2a61c914fb
docs: add release note entry for 7733 2024-01-19 15:33:07 +02:00
Elle Mouton
55ee01a6ca
itest: add taproot tower itest 2024-01-19 15:33:07 +02:00
Elle Mouton
f12cc12da5
server: register a taproot tower client 2024-01-19 15:33:07 +02:00
Elle Mouton
3cb194c45e
lnrpc+lncli: update wtclientrpc for taproot towers 2024-01-19 15:33:06 +02:00
Elle Mouton
660f1f361e
watchtower/wtclient: prep client for taproot towers 2024-01-19 15:33:06 +02:00
Oliver Gugger
c0e3ae6adc
Merge pull request #8399 from yyforyongyu/add-signing-key
scripts: add gpg key for yyforyongyu [skip ci]
2024-01-19 07:15:25 -06:00