Commit graph

16122 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
935e550da6
Merge pull request #8463 from ProofOfKeags/refactor/chainreg/rm-channel-constraints
Remove `DefaultChannelConstraints` from PartialChainControl and lnwallet.Config
2024-02-22 14:39:35 -08:00
Elle
16279765eb
Merge pull request #8464 from ellemouton/resend-shutdown-2
multi: resend shutdown on reestablish
2024-02-21 14:10:05 +02:00
Elle Mouton
2fe8520c44
docs: update release notes 2024-02-21 11:58:18 +02:00
Elle Mouton
785790abed
peer/lnwallet: persist shutdown info on send
In this commit, we start persisting shutdown info when we send the
Shutdown message. When starting up a link, we also first check if we
have previously persisted Shutdown info and if we have, we start the
link in shutdown mode meaning that it will not accept any new outgoing
HTLC additions and it will queue the shutdown message after any pending
CommitSig has been sent.
2024-02-21 11:58:18 +02:00
Elle Mouton
5de7792520
htlcswitch: ability to start link in shutdown mode
In this commit, we add the ability to start a link in shutdown mode.
This means that we immediately disable any new HTLC adds in the outgoing
direction and that we queue up a Shutdown message after the next
CommitSig message is sent (or immediately if no CommitSig message is
owed).
2024-02-21 11:57:47 +02:00
Elle Mouton
dc25b425c0
channeldb+lnwallet: add ShutdownInfo with read and write methods
ShutdownInfo contains any info about a previous Shutdown message that we
have sent. This commit adds this type along with read and write methods
for it in the channel db. The existence of the ShutdownInfo on disk
represents the fact that we have previously sent the Shutdown message
and hence that we should resend it on re-establish.
2024-02-21 11:56:15 +02:00
Elle Mouton
987604effb
itest: demonstrate shutdown on restart bug
This commit adds an itest to demonstrate that the following bug exists:
If channel Shutdown is initiated but then a re-connect is done before
the shutdown is complete, then the initiating node currently does not
properly resend the Shutdown message as required by the spec. This will
be fixed in an upcoming commit.
2024-02-21 11:35:12 +02:00
Elle Mouton
8c064b86f1
peer: call DisableAdds before link.OnCommitOnce
This commit moves calls to link.DisableAdds to outside link.OnCommitOnce
call backs. This is done so that if a user requests shutdown, then we
can immediately block any new outgoing HTLCs. It's only the sending of
the Shutdown message that needs to wait until after any pending
CommitSig message is sent.
2024-02-21 11:35:11 +02:00
Elle Mouton
972f57e9a7
peer+htlcswitch: update Enable/DisableAdds API
In this commit, the `ChannelUpdateHandler`'s `EnableAdds` and
`DisableAdds` methods are adjusted to return booleans instead of errors.
This is done becuase currently, any error returned by these methods is
treated by just logging the error since today all it means is that the
proposed update has already been done. And so all we do today is log the
error. But in future, if these methods are updated to return actual
errors that need to be handled, then we might forget to handle them
correctly at the various call sights. So we instead change the signature
of the function to just return a boolean. In future, if we do need to
return any error, we will have to go inspect every call sight in any
case to fix compliation & then we can be sure we are handling the errors
correctly.
2024-02-21 11:35:11 +02:00
Elle Mouton
71753af8ee
multi: fix various typos 2024-02-21 11:35:10 +02:00
Elle
c398b0cc69
Merge pull request #8239 from ellemouton/loadSessionByActiveTower
wtclient: add DeactivateTower and TerminateSession commands
2024-02-21 11:28:25 +02:00
Oliver Gugger
e53f7c1018
Merge pull request #8494 from yyforyongyu/update-fn
gomod: bump `fn` version to `v1.0.2`
2024-02-21 02:09:57 -06:00
yyforyongyu
d38f949072
gomod: bump fn version to v1.0.2 2024-02-21 08:35:08 +08:00
Elle Mouton
a3ccae9a55
docs: update release notes 2024-02-20 14:44:39 +02:00
Elle Mouton
4ab17525ce
itest+lntest: add wtclient session & tower management test 2024-02-20 14:44:39 +02:00
Elle Mouton
59a4bfbc59
itest+refactor: extract various tower test helpers 2024-02-20 14:44:39 +02:00
Elle Mouton
d4424fbcfa
itest: refactor watchtower related tests 2024-02-20 14:44:39 +02:00
Elle Mouton
1c7a7543c7
lnrpc: add session ID to tower session info
This will be used in the itest added in an upcoming commit so that we can
test the TerminateSession command.
2024-02-20 14:44:39 +02:00
Elle Mouton
a9648cbdd1
wtclient: load all active towers into memory
Load an active tower into memory regardless of whether or not it has any
sessions.
2024-02-20 14:44:38 +02:00
Elle Mouton
5d16491c13
lnrpc+lncli: add TerminateSession command 2024-02-20 14:44:38 +02:00
Elle Mouton
24702ede14
wtclient: add TerminateSession method 2024-02-20 14:44:37 +02:00
Elle Mouton
05c03400a9
wtdb: add TerminateSession method 2024-02-20 14:44:11 +02:00
Elle Mouton
41582c0b8b
wtdb: create and remove tower should no longer change session status 2024-02-20 14:44:11 +02:00
Elle Mouton
cbf08940ca
wtdb: let DeleteCommitedUpdates move session to terminal
In this commit, we adjust the DeleteCommitmentUpdate method so that it
marks a session as Terminal (if there are updates to delete) since once
we have deleted a commitment update from a session - the session is no
longer useable.
2024-02-20 14:44:11 +02:00
Elle Mouton
5cb8c8df7e
wtdb: rename CSessionInactive to CSessionTerminal
Since we will now change this to mean that the session should not ever
be activated again.
2024-02-20 14:44:11 +02:00
Elle Mouton
26432359ad
lnrpc+lncli: add DeactivateTower to rpc 2024-02-20 14:44:11 +02:00
Elle Mouton
beb9b2eeb8
wtclient: add DeactivateTower method
This commit adds the DeactiateTower method to the wtclient.ClientManager
interface along with its implementation. A test is also added for the
new method.
2024-02-20 14:44:09 +02:00
Elle Mouton
4548e72f79
wtdb: add a DeactivateTower method
This new method sets the tower's status to inactive so that it is not
loaded at startup as a candidate tower. We also ensure that a tower's
status is set to active if the CreateTower is called when the tower
already exists.
2024-02-20 09:02:36 +02:00
Elle Mouton
0bb1816fff
watchtower: add filter function to ListTowers
And then only load active towers on client start up.
2024-02-20 08:58:46 +02:00
Elle Mouton
ffd355c6c4
wtdb: add TowerStatus to Tower
This is added as a TLV record meaning that all the towers currently on
disk that don't have this new field will be seen as Active.
2024-02-20 08:58:46 +02:00
Elle Mouton
1ae802812c
watchtower: update DeleteCommittedUpdate to delete all
This commit updates the DeleteCommittedUpdate DB method to delete all of
a given session's committed updates instead of just one at a time. The
reason for this is that in an upcoming commit, we will introduce a
"Terminal" session state - once we have deleted a committed update for a
session it should be considered "Terminal" and there is never a case
where we would only want to delete one committed update and not the
rest. So we want these two actions (deleting committed updates of a
session and setting it's status to terminal) to be atomic.
2024-02-20 08:58:45 +02:00
Keagan McClelland
fb8de14798 lnwallet+funding+lnd: trim unused parameters, from lnwallet.Config
chainreg: remove unused GenDefaultBtcConstraints

lnwallet+funding+lnd: remove DefaultDustLimit from lnwallet.Config
2024-02-19 17:06:21 -08:00
Keagan McClelland
c6ecb10865 chainreg+lnd: remove ChannelConstraints from PartialChainControl 2024-02-19 17:06:21 -08:00
Andras Banki-Horvath
bcc6a3f517
docs: update release notes for 0.18.0 2024-02-19 20:47:25 +01:00
Andras Banki-Horvath
f5abc94bdf
mod: bump kvdb to v1.4.5 2024-02-19 20:47:25 +01:00
Andras Banki-Horvath
7d56d5385d
invoices: parametrize invoice(registry) tests with InvoiceDB constructor
This commit extracts the InvoiceDB construction from all invoice and
registry tests such that we can later on run subtests with multiple
backends without needing to use tags.
2024-02-19 20:47:25 +01:00
Andras Banki-Horvath
0e2b39ed44
invoices: fix linter issues after the move 2024-02-19 20:47:24 +01:00
Andras Banki-Horvath
5e746b4d2c
invoices: move InvoiceDB tests unrelated to kvdb to invoices package 2024-02-19 20:47:24 +01:00
Andras Banki-Horvath
6b0931af82
invoices: move UpdateInvoice implementation to the invoices package
With the introducation of the `InvoiceUpdater` interface we are now
able to move the non-kv parts of `UpdateInvoice` completely under
the invoices package. This is a preprequisite for being able to use
the same code-base for the sql InvoiceDB implementation of
UpdateInvoice.
2024-02-19 20:47:24 +01:00
Andras Banki-Horvath
ecbfc46312
invoices+channeldb: add InvoiceUpdater interface and the KV impl
This commit introduces the InvoiceUpdater interface which is meant
to abstract and assist the in-memory invoice update procedure with
the accompanying database updates. These abstract updater steps will
enable further refactoring later while also ensuring that a full
SQL implementation of the InvoiceDB interface will be possible.
2024-02-19 20:47:24 +01:00
Andras Banki-Horvath
998156930f
invoices: refactor updateInvoiceAmpState to return new state
With this commit updateInvoiceAmpState becomes getUpdatedInvoiceAmpState
which will only return the new AMP state but that needs to be applied at
the call site. This is a part of a larger refactor to gather all
mutations of an invoice update to be later applied by the invoice
updater.
2024-02-19 20:47:24 +01:00
Andras Banki-Horvath
08df7f4175
invoices: change cancelSingleHtlc to be purely used for validation
This change moves the HTLC state change out of the cancelSingleHtlc
function. This is part of the larger refactor of collecting all changes
to be later applied by the invoice updater.
2024-02-19 20:47:23 +01:00
Andras Banki-Horvath
87044b815c
invoices: rename updateInvoiceState to getUpdatedInvoiceState
This commit turns updateInvoiceState "const" by moving preimage update
out of the function while also removing it to getUpdatedInvoiceState.
2024-02-19 20:47:23 +01:00
Andras Banki-Horvath
342eb4eac2
invoices: refactor updateHtlc to return new state
With this refactor updateHtlc is renamed to getUpdatedHtlcState and
changed such that it won't change the HTLC's state and resolve time but
instead returns whether the change is needed. This change is part of a
multi-commit refactor to ensure that all changes to the invoice will be
tracked individually.
2024-02-19 20:47:23 +01:00
Andras Banki-Horvath
ef5a31733e
channeldb: do not change the update descriptor when cancelling htlcs 2024-02-19 20:47:23 +01:00
Andras Banki-Horvath
7298b2d190
channeldb: extract AMP state updates to updateInvoiceAmpState() 2024-02-19 20:47:23 +01:00
Andras Banki-Horvath
4bf6b52158
channeldb: fetch the invoice before calling into updateInvoice 2024-02-19 20:47:22 +01:00
Andras Banki-Horvath
eb4198b970
channeldb: extract store update methods when updaing an invoice
This commit is a small refactor to move all actual DB updates after
an invoice state is update to separate methods. This is a small
preliminary change before we completely decouple DB updates from
in-memory invocie update.
2024-02-19 20:47:22 +01:00
Oliver Gugger
a3bf2c70e5
Merge pull request #8486 from joaothallis/fix/link-typo
docs: fix typo and links
2024-02-19 02:43:11 -06:00
João Thallis
805c1c0d59
docs: fix contribution guide links [skip ci] 2024-02-17 21:48:01 -03:00