Commit Graph

15934 Commits

Author SHA1 Message Date
yyforyongyu
2686ca324a
lnwallet: check mempool acceptance before publishing
This commit adds a mempool acceptance check before broadcasting a given
transaction. To maintain the current behavior from
`BtcWallet.PublishTransaction`, the two errors, `ErrInMempool` and
`ErrAlreadyConfirmed` returned from `TestMempoolAccept` are ignored.
2024-01-25 07:54:39 +08:00
yyforyongyu
e4482421c9
gomod+chainreg: update btcwallet to use TestMempoolAccept 2024-01-25 07:54:35 +08:00
Olaoluwa Osuntokun
758ae6fbec
Merge pull request #8336 from lightningnetwork/fn-module-goodies
fn: add some new goodies to sub-module to be used in future PRs
2024-01-23 19:18:34 -08:00
Olaoluwa Osuntokun
1d1c1382d0
fn: add utility funcs/method for option type 2024-01-23 19:09:59 -08:00
Olaoluwa Osuntokun
1fc3f14467
fn: add new generic set container 2024-01-23 19:09:53 -08:00
Olaoluwa Osuntokun
eb72bb9712
fn: add SendOrQuit 2024-01-23 19:09:50 -08:00
Olaoluwa Osuntokun
a2694009cd
fn: add basic generic chan recv utility funcs 2024-01-23 19:09:47 -08:00
Olaoluwa Osuntokun
f7e2e6ddd6
fn: add basic generic queue 2024-01-23 19:09:45 -08:00
Olaoluwa Osuntokun
f166829fe4
fn: add reduce func 2024-01-23 19:09:42 -08:00
Olaoluwa Osuntokun
d702158d9b
fn: add new EventPublisher event pub/sub system
This builds on the concurrent queue to create a generic way to allow
goroutines to pub/sub information. An example includes being notified
each time a state machine is able to carry out a new state transition.
2024-01-23 19:09:39 -08:00
Olaoluwa Osuntokun
1cbfda525a
fn: add new Either[L, R] type
This implements a union of two values. Uses the existing option under
the hood, and adds a simple helper function.
2024-01-23 19:09:36 -08:00
Olaoluwa Osuntokun
0715e84f04
fn: add new ConcurrentQueue[T] data structure
This is a version of the queue we have elsewhere, but we can get rid of
all the casting and interface usage in favor of a type param.
2024-01-23 19:09:29 -08:00
Olaoluwa Osuntokun
1caca81ba1
Merge pull request #8167 from ProofOfKeags/bugfix/htlc-flush-shutdown
Bugfix/htlc flush shutdown
2024-01-23 18:49:47 -08:00
Keagan McClelland
69ef1b2b3b docs: update release notes 2024-01-23 14:31:57 -08:00
Keagan McClelland
07277172f8 itest+lntest: remove temporary hacks around broken coop close in itests 2024-01-23 14:31:51 -08:00
Keagan McClelland
9e58ebd0fb itest: test that we can close with in-flight htlcs 2024-01-23 12:25:06 -08:00
Keagan McClelland
94373bd96f htlcswitch: placate confused linter 2024-01-23 12:25:06 -08:00
Keagan McClelland
804dabb4ea lnd: make closechannel send an instant empty update when no_wait set
We do things this way to keep behavior consistent across REST, gRPC
and CLI consistent. This was done to not alter the way we handle
Recv calls from the streams.
2024-01-23 12:25:01 -08:00
Oliver Gugger
e31d159893
Merge pull request #8401 from yyforyongyu/update-btcd-ver
gomod: fix `btcd` mempool leak fix and `GetBlock` heap escape
2024-01-23 11:42:09 -06:00
Oliver Gugger
d7796b464e
Merge pull request #8377 from ellemouton/towerTestFlakeFix
wtclient: ensure correct disk mode for overflow queue
2024-01-23 09:47:27 -06:00
yyforyongyu
e6f5d17548
chainreg: satisfy chain.Interface in NoChainSource 2024-01-23 17:46:06 +08:00
Oliver Gugger
7d03b43ddf
Merge pull request #8314 from mohamedawnallah/add-auto-protolinter
[CI]: Install protolint to enforce the protobuf style guide rules in the CI
2024-01-23 03:25:55 -06:00
yyforyongyu
ff1f33eee9
docs: update release notes for mem leak fix 2024-01-23 17:09:44 +08:00
yyforyongyu
4ee862e3be
blockcache: fix heap escape in GetBlock
This commit fixes a heap escape found in `GetBlock`. This happens
because the `msgBlock` is a pointer returned from `getBlockImpl`, and
the whole `getBlockImpl` escapes to the heap because it's referenced in
two places,
- in the `Cache`, it's used as a reference type to create the new block.
- this pointer is also returned and now needs to stay on the heap.

The fix is simple, we now make a copy of the block and use the copy
instead, freeing `getBlockImpl` from the heap.
2024-01-23 17:08:57 +08:00
yyforyongyu
77e5deae9d
gomod: update btcd version to fix mem leak 2024-01-23 17:08:54 +08:00
Elle
51de320d69
Merge pull request #8385 from Roasbeef/ping-async-dc
peer: make PingManager disconnect call async
2024-01-23 09:24:11 +02:00
Keagan McClelland
359f271541
docs: update release notes 2024-01-22 18:20:36 -08:00
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