Commit Graph

14778 Commits

Author SHA1 Message Date
Elle Mouton
7bc86ca42e
watchtower: add PreEvaluateFilterFn callback
In this commit, a PreEvaluateFilterFn option is added to the
wtdb.ClientSessionListCfg and it is used instead of a separate
ClientSessionFilterFn parameter. This neatens quiet a few function
signatures.
2023-03-20 20:14:01 +02:00
Oliver Gugger
c4c1f1ac92
Merge pull request #7069 from ellemouton/deleteSessions
watchtower: start using the DeleteSession message
2023-03-20 18:45:36 +01:00
Elle Mouton
ab98fc43fe
docs: add release note for 7069 2023-03-20 16:51:51 +02:00
Elle Mouton
6f4034f7d1
lntest/itest: add session deletion itest 2023-03-20 16:51:51 +02:00
Elle Mouton
31beacc2c4
lnrpc/wtclientrpc: populate sessions from legacy channels 2023-03-20 16:51:51 +02:00
Elle Mouton
bad80ff583
multi: make tower MaxUpdates configurable
This is helpful in an itest environment where we want to quickly
saturate a session.
2023-03-20 16:51:51 +02:00
Elle Mouton
d840761cc4
watchtower: dont load closed channel details
In this commit, the FetchChanSummaries method is adapted to skip loading
any channel summaries if the channel has been marked as closed.
2023-03-20 16:51:51 +02:00
Elle Mouton
26e628c0fe
watchtowers: handle closable sessions
Add a routine to the tower client that informs towers of sessions they
can delete and also deletes any info about the session from the client
DB.
2023-03-20 16:51:51 +02:00
Elle Mouton
8478b56ce6
watchtower: method to dial tower and send DeleteSession
This commit adds a deleteSessionFromTower method which can be used to
dial the tower that we created a given session with and then sends that
tower the DeleteSession method.
2023-03-20 16:51:33 +02:00
Elle Mouton
0209e6feb8
watchtower/wtclient: add Copy method to AddressIterator 2023-03-20 16:51:32 +02:00
Elle Mouton
2b08d3443f
watchtowers: add thread safe min-heap
In this commit, a thread-safe min-heap is implemented. It will carry
sessionCloseItems which carry a sessionID and a block height at which
the session should be closed.
2023-03-20 16:51:32 +02:00
Elle Mouton
16008c0032
watchtower: handle channel closures
Add a channel-close handler that waits for channel close events and
marks channels as closed in the tower client DB.
2023-03-20 16:51:25 +02:00
Elle Mouton
41e36c7ec7
watchtower: add wtclient.ClientSession constructor 2023-03-20 10:46:53 +02:00
Elle Mouton
0ed5c750c8
watchtower: add GetTower to tower iterator
Add a GetTower method to the tower iterator.
2023-03-20 10:46:53 +02:00
Elle Mouton
e432261dab
watchtower: add DeleteSession method
Add a DeleteSession method to the tower client DB. This can be used to
delete a closable session along with any references to the session.
2023-03-20 10:46:52 +02:00
Elle Mouton
3577c829d3
watchtower: add ListClosableSessions method
This commit adds a new ListClosableSessions method to the tower client
DB. This method will return a map of sessionIDs to block heights. The
IDs belong to sessions that are considered closable and the block
heights are the block height at which the last associated channel for
the session was closed in.
2023-03-20 10:46:52 +02:00
Elle Mouton
571966440c
watchtower: add MarkChannelClosed db method
This commit adds a `MarkChannelClosed` method to the tower client DB.
This function can be called when a channel is closed and it will
check the channel's associated sessions to see if any of them are
"closable". Any closable sessions are added to a new
`cClosableSessionsBkt` bucket so that they can be evaluated in future.
Note that only the logic for this function is added in this commit and
it is not yet called.
2023-03-20 10:46:52 +02:00
Elle Mouton
a3050ed213
watchtower: add GetClientSession func to DB
This commit adds a new `GetClientSession` method to the tower client DB
which can be used to fetch a session by its ID from the DB.
2023-03-20 10:46:52 +02:00
Elle Mouton
5283e2c341
watchtower/wtdb: remove unnecessary tower load 2023-03-20 10:46:52 +02:00
Elle Mouton
ee0353dd24
watchtower: build channel to sessionIDs index
In this commit, a migration is added that adds an index from channel to
sessionIDs (using the DB-assigned session IDs). This will make it easier
in future to know which sessions have updates for which channels.
2023-03-20 10:46:52 +02:00
Elle Mouton
b16df45076
watchtower: add sessionID index
In this commit, a new session-ID index is added to the tower client db
with the help of a migration. This index holds a mapping from a
db-assigned-ID (a uint64 encoded using BigSize encoding) to real session
ID (33 bytes). This mapping will help us save space in future when
persisting references to sessions.
2023-03-20 10:46:52 +02:00
yyforyongyu
c4aea6e789
docs: update release note for channel_ready 2023-03-17 18:22:00 +08:00
yyforyongyu
dc3f83c670
funding+lnwire: rename and fix make lint
Fix linter and rename `funding_locked.go` to `channel_ready.go`
2023-03-17 18:21:59 +08:00
yyforyongyu
d4ad5f362f
funding: replace fundingLocked found in docs
This commit is created by running,
```shell
find . -name "*.go" -exec sed -i '' 's/fundingLocked/channelReady/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
465285efb8
funding: replace fundingLocked with channelReady 2023-03-17 18:21:59 +08:00
yyforyongyu
6b9217acfc
multi: replace FundingLocked related docs
This commit replaces `FundingLocked` found in docs using the following
command,
```shell
find . -name "*.go" -exec sed -i '' 's/FundingLocked/ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLock/ChannelReady/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
f8a8326141
multi: replace FundingLocked and funding_locked strings
This commit is created by running the following commands,
```shell
find . -name "*.go" -exec sed -i '' 's/\"FundingLocked/\"ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLocked\"/ChannelReady\"/g' {} \;
find . -name "*.go" -exec sed -i '' 's/\ funding_locked/\ channel_ready/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
015446559b
funding+lnwire: rename FundingLocked related tests
This commit is created by running the following commands,

```shell
gofmt -d -w -r 'fundingLockedAlice -> channelReadyAlice' .
gofmt -d -w -r 'fundingLockedBob -> channelReadyBob' .
gofmt -d -w -r 'assertHandleFundingLocked -> assertHandleChannelReady' .
gofmt -d -w -r 'assertFundingLockedSent -> assertChannelReadySent' .
gofmt -d -w -r 'aliceFundingLocked -> aliceChannelReady' .
gofmt -d -w -r 'bobFundingLocked -> bobChannelReady' .
gofmt -d -w -r 'FuzzFundingLocked -> FuzzChannelReady' .
gofmt -d -w -r 'newMsgFundingLocked -> newMsgChannelReady' .
gofmt -d -w -r 'TestFundingManagerReceiveFundingLockedTwice -> TestFundingManagerReceiveChannelReadyTwice' .
gofmt -d -w -r 'TestFundingManagerRestartAfterReceivingFundingLocked -> TestFundingManagerRestartAfterReceivingChannelReady' .
```
2023-03-17 18:21:59 +08:00
yyforyongyu
539cae1999
multi: rename fundingLockedMsg to channelReadyMsg
This commit is created by running,
```shell
gofmt -d -w -r 'fundingLockedMsg -> channelReadyMsg' .
```
2023-03-17 18:21:59 +08:00
yyforyongyu
112dc1faca
funding: rename FundingLocked related functions and variables
This commit is created by running the following commands,
```shell
gofmt -d -w -r 'sendFundingLocked -> sendChannelReady' .

gofmt -d -w -r 'handleFundingLockedMtx -> handleChannelReadyMtx' .

gofmt -d -w -r 'handleFundingLockedBarriers -> handleChannelReadyBarriers' .

gofmt -d -w -r 'receivedFundingLocked -> receivedChannelReady' .

gofmt -d -w -r 'handleFundingLocked -> handleChannelReady' .

gofmt -d -w -r 'fundingLockedSent -> channelReadySent' .

gofmt -d -w -r 'checkPeerFundingLockInterval -> checkPeerChannelReadyInterval' .
```
2023-03-17 18:21:58 +08:00
yyforyongyu
2dc08a2a76
multi: rename NewFundingLocked to NewChannelReady
This commit is created by the following command,

```shell
gofmt -d -w -r 'NewFundingLocked -> NewChannelReady' .
```
2023-03-17 18:21:58 +08:00
yyforyongyu
c8e8358918
channeldb+lnwire: rename MsgFundingLocked to MsgChannelReady
This commit is created by running,

```shell
gofmt -d -w -r 'MsgFundingLocked -> MsgChannelReady' .

gco master channeldb/migration
```
2023-03-17 18:21:58 +08:00
yyforyongyu
1b7c56b2ed
multi: rename FundingLocked to ChannelReady
This commit is created by running,

```shell
gofmt -d -w -r 'FundingLocked -> ChannelReady' .

gco master channeldb/migration
```
2023-03-17 18:21:58 +08:00
Oliver Gugger
ae39cd9e91
Merge pull request #7514 from yyforyongyu/rpc-verbose-log
itest+rpcserver: fix itest flake in `3rd_party_anchor_spend`
2023-03-17 08:48:40 +01:00
yyforyongyu
ef4b5dba85
docs: update release note 2023-03-17 10:01:42 +08:00
yyforyongyu
9bd0dcd121
rpcserver: add debug log for rpc calls 2023-03-17 10:01:42 +08:00
yyforyongyu
c87da1ff01
itest: fix flake in testAnchorThirdPartySpend 2023-03-17 03:17:36 +08:00
Oliver Gugger
2e8dc7bf94
Merge pull request #7439 from ellemouton/bolt3-test-vectors
lnwallet: update Bolt3 test vectors
2023-03-16 18:47:19 +01:00
Oliver Gugger
2869b70808
Merge pull request #7059 from ellemouton/sessionFiltering
multi+towers: add ClientSessionFilterFn option
2023-03-16 16:58:04 +01:00
Oliver Gugger
b7697a7257
Merge pull request #7377 from positiveblue/split-update-invoice
channeldb: split `UpdateInvoice` logic
2023-03-16 16:39:29 +01:00
Elle Mouton
05793e5591
docs: add release note 2023-03-16 17:27:39 +02:00
Elle Mouton
b607db30f9
lnwallet: add zero-fee-htlc-tx test vectors 2023-03-16 17:27:05 +02:00
Elle Mouton
6774b72913
lnwallet: add same amount and preimage anchors test vector 2023-03-16 17:27:05 +02:00
Elle Mouton
a41f6d5a73
lnwallet: add same amount and preimage legacy test vector 2023-03-16 17:27:04 +02:00
Elle Mouton
4f14193ca9
lnwallet: add new htlc set for test vectors
Add a new test htlc set comprised of htlc 1 from the original set and
two new htlcs, 5 and 6, that use the same preimage and have the same
output value (in sats). This htlc set is used in tests that assert the
ordering of htlcs  that have the same preimage and output value.
2023-03-16 17:27:04 +02:00
Elle Mouton
dbc19b24e5
lnwallet: add funding amount assertion to tests
In this commit, an assertion is added to the bolt 3 commitment tx tests
that ensures that the local and remote balances add up to the expected
funding amount. Adding this assertion uncovered a borked test vector
which is also fixed in this commit.
2023-03-16 17:27:04 +02:00
Elle Mouton
09ff853b9c
lnwallet: lint bolt 3 test vectors func 2023-03-16 17:27:04 +02:00
Elle Mouton
15da50df10
lnwallet: remove dead code 2023-03-16 17:27:04 +02:00
Elle Mouton
b5d281dca8
lnwallet: run commitment tx tests in parallel 2023-03-16 17:27:03 +02:00
Elle Mouton
bc868fe270
docs: update release notes with 7059 2023-03-16 15:00:26 +02:00