479 Commits
Author SHA1 Message Date
Gijs van Dam 09379d0381 wtclient: fix race conditions locking tests
This commit fixes two flaky test scenarios:

1. testRemoveLockedAddr: Add synchronization to wait for the dial to
   start before asserting that the address is locked. Previously, the
   test could race and check the lock state before session negotiation
   began.

2. testTowerSwitch: Use wait.Predicate for RemoveTower since the
   address may still be locked by an active session, causing
   intermittent failures.
2026-02-12 13:02:02 +01:00
Elle Mouton c945f6749e input+signrpc+lnwallet+multi: implement combined nonce support
Add CombinedNonce() and RegisterCombinedNonce() methods with full implementation
stack.

Interface and core implementation:
- input/musig2.go: Added methods to MuSig2Session and MuSig2Signer interfaces
- input/musig2_session_manager.go: MusigSessionManager implementation using
  HaveAllNonces flag for state tracking (simplified, no extra fields)
- internal/musig2v040: Stub implementations returning ErrUnsupportedMethod
- Mock implementations (MockInputSigner, MockSigner, DummySigner)

RPC layer:
- lnrpc/signrpc/signer.proto: RPC method definitions and messages
- lnrpc/signrpc/signer.yaml: REST API endpoint mappings
- Generated protobuf code (all .pb.go files)
- lnwallet/rpcwallet/rpcwallet.go: RPCKeyRing client implementation

The proto types and RPCKeyRing are added together since RPCKeyRing implements
the Signer interface and requires proto types to fulfill the contract.

For v0.4.0, these methods return ErrUnsupportedMethod. Use MuSig2Version100RC2
to access these features.
2025-12-10 07:15:06 +02:00
ziggie d2d56f2968 linter: remove unsupported linters from the codebase 2025-11-12 22:54:02 +08:00
Olaoluwa Osuntokun 77f2d8a572 contractcourt+sweep+watchtower: use lnutils.SpewLogClosure for debug logging
In this commit, we update the contractcourt, sweep, and watchtower
packages to use lnutils.SpewLogClosure instead of directly calling
spew.Sdump in logging statements.
2025-09-05 18:20:51 -07:00
yyforyongyu bef90c6a84 watchtower: fix logging and add comments 2025-06-27 19:01:33 +08:00
xinhangzhou b7e3c20383 refactor: use maps.Copy for cleaner map handling
Signed-off-by: xinhangzhou <shuangcui@aliyun.com>
2025-03-25 01:19:55 +08:00
Eugene Siegel 6eb746fbba server.go+accessman.go: introduce caches for access permissions
Here we introduce the access manager which has caches that will
determine the access control status of our peers. Peers that have
had their funding transaction confirm with us are protected. Peers
that only have pending-open channels with us are temporary access
and can have their access revoked. The rest of the peers are granted
restricted access.
2025-03-11 20:42:34 -04:00
Eng Zer Jun 0899cee987 refactor: replace min/max helpers with built-in min/max
We can use the built-in `min` and `max` functions since Go 1.21.

Reference: https://go.dev/ref/spec#Min_and_max
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2025-02-06 09:45:10 +08:00
Keagan McClelland ed2989ae33 multi: update to fn v2 2024-12-04 13:19:00 -07:00
Elle Mouton ab7aae0708 multi: rename nolint:lll to nolint:ll
Find and replace all nolint instances refering to the `lll` linter and
replace with `ll` which is the name of our custom version of the `lll`
linter which can be used to ignore log lines during linting.

The next commit will do the configuration of the custom linter and
disable the default one.
2024-12-02 09:14:21 +02:00
Elle Mouton c2923e2214 multi: remove PrefixLog
And instead use the new btclog Logger `WithPrefix` method.
2024-11-27 10:44:32 +02:00
chuangjinglu bcfd8d5b47 multi: fix some function names in interface comment
Signed-off-by: chuangjinglu <chuangjinglu@outlook.com>
2024-11-25 10:49:00 +08:00
Oliver Gugger e1df8e9161 Merge pull request #9281 from ziggie1984/export-towerclientdb-version
wtdb: export versions of wtclient.db
2024-11-19 17:53:14 +01:00
ziggie aaa0abc8a9 wtdb: export versions of wtclient.db
We now make it possible to get the current db version of the
wtclient.db. Moreover we can now fetch the latest available
migration version for the client db. This allows us to compare
whether the client.db has all the expected migrations applied.
2024-11-19 16:42:52 +01:00
Matt Morehouse 9dd921243d wtwire: explain emptyMsg parameter in function comment
This makes it unnecessary to explain the argument at every call site, so
we can simplify each fuzz target.
2024-11-13 15:53:29 -06:00
Matt Morehouse 567ff5d751 wtwire: remove incorrect function comment
The harness doesn't return anything, so don't say that it does.
2024-11-13 15:53:29 -06:00
Matt Morehouse e2f7eb963f wtwire: move message prefixing to the harness
The prefixing is done every time the harness is used, so it may as well
reside in the harness itself.

Since we already pass an empty message of the correct type, we can use
that message to get the required prefix bytes.
2024-11-13 15:53:29 -06:00
Matt Morehouse 38f9f795e4 wtwire: s/harness/wireMsgHarness
This slightly more descriptive name obviates the repetitive comments at
every call site.
2024-11-13 15:53:29 -06:00
Animesh Bilthare ecd4480331 watchtower: Add retry logic for fetching blocks
By default, try to fetch the blocks 3 more times
in case of error.
2024-10-26 16:59:13 +05:30
Oren 54b30423a3 watchtower: fix comments on breach hint and key 2024-10-25 00:07:04 +03:00
Elle Mouton 9d0cd3ff4f multi: update more loggers to the v2 type 2024-10-22 17:03:56 +02:00
Elle Mouton 23602e017e multi: start updating various loggers to use the new v2 type 2024-10-22 17:03:55 +02:00
Olaoluwa Osuntokun 1aae47fd71 input+lnwallet: update taproot scripts to accept optional aux leaf
In this commit, we update all the taproot scripts to also accept an
optional aux leaf. This aux leaf can be used to add more redemption
paths for advanced channels, or just as an extra commitment space.
2024-08-28 11:52:31 +02:00
Oliver Gugger e99e6662cf multi: update linter, fix new issues 2024-08-20 19:14:44 +02:00
yyforyongyu b6049ff94b multi: add NewLogClosure in lnutils to avoid repetition
And replaces all usage of `logClosure` with `lnutils.LogClosure`.
2024-07-25 21:25:23 +08:00
yyforyongyu 8da68bb7db multi: apply the new type lntypes.WeightUnit 2024-05-25 13:37:13 +08:00
erik c7f81d3142 multi: replace ioutil.Discard 2024-04-25 11:23:54 +02:00
yyforyongyu e771993785 multi: make input.OutPoint return wire.OutPoint 2024-04-19 21:33:32 +08:00
Oliver Gugger 648fb22f63 multi: wrap all errors 2024-04-11 15:04:03 +02:00
undefinedor 028959f5a0 kvdb+watchtower: fix unreachable code 2024-03-25 21:04:48 +08:00
Oliver Gugger 5cb4811e86 Merge pull request #8425 from ProofOfKeags/refactor/lnwallet/chan-point-leaks
[EZ Review]: avoid leaking pointers to authoritative ChannelPoint
2024-03-11 00:55:41 -06:00
Keagan McClelland db39a905cb multi: make NewChanIDFromOutpoint accept value instead of pointer 2024-03-08 15:47:55 -08:00
cuinix 60bc30dd08 remove repetitive words
Signed-off-by: cuinix <915115094@qq.com>
2024-03-07 14:05:47 +08:00
ffranr cd566eb097 multi: fix fmt.Errorf error wrapping
Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
2024-02-27 11:13:40 +00: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 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 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
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
Elle Mouton 660f1f361e watchtower/wtclient: prep client for taproot towers 2024-01-19 15:33:06 +02:00
Elle Mouton c50aa10194 watchtower/lookout: make justice desciptor taproot ready 2024-01-18 18:06:00 +02:00
Elle Mouton 5960253357 watchtower/blob: add taproot Commitment type 2024-01-18 18:05:58 +02:00
Elle Mouton d84a98e3db watchtower/blob: add taprootJusticeKit implementation 2024-01-18 17:59:14 +02:00