Commit Graph
76 Commits
Author SHA1 Message Date
Boris Nagaev 031c792b56 lncli: remove dead code
Variable chanPoints was accumulated but never used. Found with staticcheck tool.

The code is dead since 8f5d78c875
2025-11-19 21:51:40 -03:00
Boris Nagaev 86e3b1b05c docs: move release notes from 0.20.0 to 0.21.0
Remove the chain notifier RPC note from the 0.20 release notes and add it to
0.21.
2025-11-13 12:54:25 -03:00
Boris Nagaev e4313eba85 docs: add release notes entry
Also fixed a typo in release notes.
2025-11-06 23:01:54 -03:00
Boris Nagaev 9520a390ed chainrpc: return Unavailable while notifier starts
From v0.20.0-rc3 (commit c6f458e478) onward
the ChainNotifier sub-server may still be initialising when clients attempt
to subscribe, currently resulting in a gRPC Unknown error with a plain-text
message. Change the notifier RPC endpoints to return codes.Unavailable instead
so clients can reliably interpret the condition as "retry later" and handle
the startup lag without unstable string matching.
2025-11-06 21:58:46 -03:00
Boris Nagaev 6ee8e2a84d multi: update mapstructure/v2
go-viper's mapstructure may leak sensitive information in logs when processing
malformed data. Updating to the version where the bug is fixed.
2025-10-21 15:22:45 -03:00
Boris Nagaev 4fc8d8dda3 build: update CI+release version to Go 1.25.3
We also update the go.mod files to pin to Go 1.24.9.
2025-10-21 14:32:44 -03:00
Boris Nagaev b88b25e781 release.sh: make sure GNU gzip is used
On MacOS, the default BSD gzip produces a different output than the GNU gzip
on Linux. To ensure reproducible builds, we need to use GNU gzip.

This is similar to what we do to enforce GNU tar.
2025-10-03 22:28:03 -03:00
Boris Nagaev c86826ac5b lntest: fix error check in shutdownAllNodes
Previously the test failed only if the last node failed to shutdown. The code
was updated to fail if any node failed to shutdown.
2025-08-30 14:13:44 -03:00
Boris Nagaev 630108b13d multi: golang.org/x/net/context -> context 2025-08-30 14:13:44 -03:00
Boris Nagaev dee8ad3754 multi: context.Background() -> t.Context()
Use the new feature of Go 1.24, fix linter warnings.

This change was produced by:
 - running golangci-lint run --fix
 - sed 's/context.Background/t.Context/' -i `git grep -l context.Background | grep test.go`
 - manually fixing broken tests
 - itest, lntest: use ht.Context() where ht or hn is available
 - in HarnessNode.Stop() we keep using context.Background(), because it is
   called from a cleanup handler in which t.Context() is canceled already.
2025-08-30 14:13:44 -03:00
Boris Nagaev 6ffe257004 multi: bump Go to 1.24.6 2025-08-30 14:13:44 -03:00
Boris Nagaev 612ad7da27 multi: fix non-constant input of fmt.Errorf
Fixed multiple cases in which a non-constact string variable was used as a
format string for fmt.Errorf.
2025-08-30 14:13:44 -03:00
Boris Nagaev f3d52ba7a8 htlcswitch: don't pass err.Error() to failf
It resulted in interpreting the error message as a format string.
Use failf("%v", err) instead.
2025-08-30 14:13:44 -03:00
Boris Nagaev 2a599bedc0 multi: don't pass err.Error() to Fatalf
It resulted in interpreting the error message as a format string.
Use Fatal(err) instead.
2025-08-30 14:13:44 -03:00
Boris Nagaev 66c7e72c0d tor: fix go vet error in Go 1.24
non-constant format string in call to (*net/textproto.Conn).Cmd
2025-08-30 14:13:44 -03:00
Boris Nagaev 8533585d0b docs/INSTALL: remove trailing spaces 2025-08-20 16:04:30 -03:00
Boris Nagaev ba5f3c0485 tools: fix building golangci-lint on Arm64
If CGO is enabled, Go tries to use the gold linker (-fuse-ld=gold), which is
not installed. CGO was disabled, because it is not needed for golangci-lint.
2025-08-20 16:04:30 -03:00
Boris Nagaev aacb94c6d3 doc: add release note (EstimateFee conf_target 1) 2025-08-01 17:16:02 -03:00
Boris Nagaev c22768283c walletrpc: allow conf_target=1 in FundPsbt
Modified 'fund_psbt' itest to test this scenario.
2025-08-01 17:16:02 -03:00
Boris Nagaev cd6e648a7f itest: add test for walletrpc.EstimateFee
Make sure conf_target=1 is accepted, but conf_target=0 is not.
2025-08-01 17:16:00 -03:00
Boris Nagaev b0e9a4b79f walletrpc: allow conf_target=1 in EstimateFee
See https://github.com/lightningnetwork/lnd/pull/9611#issuecomment-3082770038
2025-08-01 17:15:09 -03:00
Boris Nagaev 8723113d27 itest: RegisterSpendNtfn detects reorgs
Added itest "reorg_notifications" which tests that RegisterSpendNtfn behaves as
expected during a reorg. A reorg notification is produced after a reorg affects
the block which has produced a spending notification for this registration.
2025-07-28 20:18:09 -03:00
Boris Nagaev d02520d2b9 go.mod: bump mapstructure/v2 to v2.3.0 2025-07-25 12:21:18 -03:00
Boris Nagaev 3ff11e0765 go.mod: bump runc to v1.1.14 2025-07-25 12:21:13 -03:00
Boris Nagaev 9e58a644aa go.mod: bump google.golang.org/protobuf to 1.33.0
Updated github.com/golang/protobuf to v1.5.4 to be compatible with
google.golang.org/protobuf.

Updated the pinned version in pinned_dep CI job.
2025-07-25 12:20:24 -03:00
Boris Nagaev aff7570845 go.mod: move indirect deps to the bottom group 2025-07-16 01:21:33 -03:00
Boris Nagaev ec6688fc1e kvdb: remove unused replace directive
github.com/dgrijalva/jwt-go package is not referenced in any transitive
dependency anymore which allows us to remove one of the replace directives
which was added as a security precaution before.
2025-07-16 01:19:58 -03:00
Boris Nagaev 643fbb8af6 multi: update Go to 1.23.10 2025-07-16 01:19:58 -03:00
Boris Nagaev fb48ffe2b6 multi: update btcd to v0.24.2 2025-07-16 01:19:58 -03:00
Boris Nagaev ea7d9fcc14 multi: update pgx/v5 to v5.7.4, pgx/v4 to v4.18.3 2025-07-16 01:19:58 -03:00
Boris Nagaev dc6ce69bad multi: update x/net to v0.39.0 2025-07-16 01:19:58 -03:00
Boris Nagaev eb5ec87498 multi: update docker Go package to v28.1.1 2025-07-16 01:19:55 -03:00
Boris Nagaev 2bf67711dd multi: update golang-jwt to 4.5.2 2025-07-16 01:18:22 -03:00
Boris Nagaev 4ec9708acc multi: update x/crypto to v0.37.0 2025-07-16 01:18:22 -03:00
Boris Nagaev 5dcafeca19 lnrpc: remove unused type ConfirmationUpdate
The type is not used since 237f2b6d4b
2025-06-24 15:28:33 -03:00
Boris Nagaev 61b3670113 lntest: do not do IO under mutex in fee_service
If HTTP response is consumed slowly, this might block other HTTP requests to
the fee service, because the mutex is held.
2025-06-24 00:44:45 -03:00
Boris Nagaev 7b70ad7fd1 docs: update release notes 2025-06-22 11:06:54 -03:00
Boris Nagaev 9100be5ba5 lntest: add method P2PAddr to backend
It is useful if we want to keep bitcoind main itest mode, but connect one node
using neutrino.
2025-06-22 11:06:54 -03:00
Boris Nagaev 07217f2dd8 lntest: fix p2p port binding
Use an additional -bind flag instead of -port to specify the default p2p port.

Flag -port sets the default port number that will be used for any -bind or
-whitebind that does not explicitly specify a port. So if we have the p2p
port set in -port and the tor p2p port set in a single -bind, bitcoind binds
only one port - the tor p2p port. And the default p2p port remained not bound!
2025-06-22 11:06:54 -03:00
Boris Nagaev 3d0031435c lntest: serve compact filters for neutrino
Enable this in bitcoind mode as well to be able to let a subset of LND nodes
to use neutrino with bitcoind backend.
2025-06-22 11:06:49 -03:00
Boris Nagaev 409bf3c6cc docs: update release notes (include_auth_proof) 2025-06-19 18:19:33 -03:00
Boris Nagaev 7a70dcb36e lnrpc: add auth_proof to graph APIs
Added flag include_auth_proof to DescribeGraph, GetNodeInfo, GetChanInfo
and the corresponding lncli commands. With the flag, these APIs add AuthProof
(signatures from the channel announcement) to the returned ChannelEdge.

This is useful to extract this data from the DB.
2025-06-19 18:19:33 -03:00
Boris Nagaev dc2cad9b0f docs: update release-notes for 0.19.0 2025-04-23 11:53:30 -03:00
Boris Nagaev c9b5974341 itest: test imported address in coop close
Make sure that an address imported to LND via ImportTapscript or ImportPublicKey
can be used as a delivery address in coop close.

New test cases:
 - P2TR address imported with ImportTapscript
 - P2TR address imported with ImportPublicKey
 - P2WPKH address imported with ImportPublicKey

Safeguard against https://github.com/lightninglabs/loop/issues/923
2025-04-23 11:53:29 -03:00
Boris Nagaev 6451ce495a itest: use prefixed sub-tests
More sub-tests are needed in "coop close with external delivery" itest, which
would break the limit for 50 blocks mined. Turning it into prefixed itest.

Also used new exclusion approach in test "remote signer" where all the prefixed
tests are excluded.
2025-04-23 11:52:39 -03:00
Boris Nagaev 429000e360 lnwallet: fix InternalKeyForAddr for imported addr
An address imported using ImportTapscript doesn't provide a private key
so it can't satisfy waddrmgr.ManagedPubKeyAddress interface. So we don't
return an error for imported addresses.
Fix https://github.com/lightninglabs/loop/issues/923
2025-04-23 11:17:00 -03:00
Boris Nagaev b5c9df81f0 lnwallet: fix error message
Include the variable of interest (walletAddr), not the outcome of the check
(pubKeyAddr) which is always nil.
2025-04-23 11:17:00 -03:00
Boris Nagaev acd296e760 chainrpc: fix description of several methods
They pointed to a non-existing type ChainNotifierService. The actual name
of the interface is ChainNotifierServer.
2025-04-08 17:43:23 -03:00
Boris Nagaev 0916f3e9b3 walletrpc: fix description of bumpfee.immediate
It waits for the next block and sends CPFP even if there are no other
inputs to form a batch.
2025-02-17 13:33:16 -03:00
Boris Nagaev 07c46680e9 fn/ContextGuard: use context.AfterFunc to wait
Simplifies context cancellation handling by using context.AfterFunc instead of a
goroutine to wait for context cancellation. This approach avoids the overhead of
a goroutine during the waiting period.

For ctxQuitUnsafe, since g.quit is closed only in the Quit method (which also
cancels all associated contexts), waiting on context cancellation ensures the
same behavior without unnecessary dependency on g.quit.

Added a test to ensure that the Create method does not launch any goroutines.
2025-01-02 10:38:26 -03:00
Boris Nagaev e9ab603735 fn/ContextGuard: clear store of cancel funcs
If ContextGuard lives for some time after Quit method is called, the map won't
be collected by GC. Optimization.
2025-01-02 10:38:26 -03:00
Boris Nagaev 1750aec13d fn: remove uneeded argument of ctxBlocking
Removed 'cancel' argument, because it is called only in case the context has
already expired and the only action that cancel function did was cancelling the
context.
2025-01-02 10:38:26 -03:00
Boris Nagaev 865da9c525 fn/ContextGuard: test cancelling blocking context
Make sure WgWait() doesn't block.
2025-01-02 10:38:26 -03:00
Boris Nagaev 23b025cff6 docs: add release notes (feerate estimator) 2024-11-27 10:30:52 -03:00
Boris Nagaev b89387a6da chainreg: use feerate estimator in regtest, simnet
If feeurl is not provided and LND is running in bitcoind or btcd mode, use
fee estimator provided by bitcoind or btcd instead of using static fee estimator
(which always returns 50 sats/vbyte).

This enables simulating high feerate environment in regtest and simnet not only
via feeurl, but also by filling mempool with high feerate transactions, which is
closer to what happens in mainnet.

Also skip creating bitcoind or btcd fee estimator, if feeurl is provided. Before
LND logged both "Initializing bitcoind backed fee estimator" and "Using external
fee estimator" if running in bitcoind mode with feeurl provided, but actually
feeurl was used, so this is not a change of behavior.
2024-11-27 10:24:26 -03:00
Boris Nagaev 64c660c19e itest: test "lnd --debuglevel=show" command
Tests that "lnd --debuglevel=show" command works and prints the list of
supported subsystems.
2024-11-19 12:44:57 -03:00
Boris Nagaev 3360d285fb config: improve error message
Previously, the error message had one missing space:
"... either --bitcoin.mainnet, or bitcoin.testnet,bitcoin.simnet, ..."

I added a space after "bitcoin.testnet,".
2024-11-19 12:44:57 -03:00
Boris Nagaev 1bc25c1136 config: fix "lnd --debuglevel show" command
Previously, "lnd --debuglevel show" complained that bitcoin backend is not
configured:

$ lnd --debuglevel show
failed to load config: ValidateConfig: either --bitcoin.mainnet, or ...

To make it working, the user had to specify --bitcoin.mainnet and configure one
of the backends, e.g. "--bitcoin.node neutrino".

With this fix, the command works without any additional flags.
2024-11-19 12:44:55 -03:00
Boris Nagaev 891e9621d7 fn: GoroutineManager.Go returns bool, not error
This was requested in https://github.com/lightningnetwork/lnd/pull/9140#discussion_r1821181787
2024-11-14 15:03:25 -03:00
Boris Nagaev 669ebf49d4 fn: stress test GoroutineManager.Stop calls
Make sure there is no race condition between Done() and Wait() methods in the
GoroutineManager implementation.

See https://github.com/lightningnetwork/lnd/pull/9141#issuecomment-2467726384
2024-11-14 01:13:02 -03:00
Boris Nagaev 4b87072514 itest: coop_close_with_external_delivery with p2tr
Customize the itest with the type of external delivery address. Test with P2TR
address type in addition to P2WKPH.
2024-10-28 11:10:41 -03:00
Boris Nagaev 9fec11eeb5 lnwallet: fix closechannel for P2TR external addr
If the delivery address is P2TR, function InternalKeyForAddr checks its
existance in the wallet to return internal key for it in case it is a custom
taproot channel. It used to return the error returned by wallet.AddressInfo.
The error is now ignored if it is ErrAddressNotFound error. This fixes
"lncli closechannel --delivery_addr <external p2tr address" case.
2024-10-28 11:08:15 -03:00
Boris Nagaev 04a2003f3b peer: fix logging (missing argument) [skip ci]
Previously, LND log used to have such records:
[WRN] PEER: Peer(...): Link=%!v(MISSING) is not active

Now the short channel ID is printed there instead of "%!v(MISSING)".
2024-10-18 12:09:44 -03:00
Boris Nagaev 65df996358 docs/recovery: add Last resort manual force close
Also updated release-notes.
2024-10-14 09:44:32 -03:00
Boris Nagaev eda06b19c6 itest: test channel.backup changes upon shutdown 2024-10-14 09:44:32 -03:00
Boris Nagaev 25eecd7a87 lnwallet: fix godoc of TapscriptTweak 2024-10-14 09:44:32 -03:00
Boris Nagaev 3de94c11ae lntest: fix typo 2024-10-14 09:44:32 -03:00
Boris Nagaev ef8535356b itest/lnd_channel_backup_test: fix typos 2024-10-14 09:44:32 -03:00
Boris Nagaev 29946df4e5 server: produces a channel backup upon shutdown
This is needed to keep channel.backup up-to-date if the node is stopped.
2024-10-14 09:44:32 -03:00
Boris Nagaev fb397c11f1 chanbackup/pubsub: add method ManualUpdate
This method inserts channel updates and waits for them to be processed. It will
be used to update channel.backup upon LND shutdown.
2024-10-14 09:44:32 -03:00
Boris Nagaev df84148ed2 chanbackup: add Single.CloseTxInputs field
The field is optional. It stores inputs needed to produce signed commit tx using
chantools scbforceclose, which calls function GetSignedCommitTx. New backups
have this field filled if commit tx is available (for all cases except when DLP
is active). If a backup has this data, the field is filled from it, otherwise it
is kept empty.

Modified test function genRandomOpenChannelShell to cover new types of channels
(simple taproot channel and custom channel) and to cover combinations of bits.
Make sure that TapscriptRoot field is properly packed and unpacked.
2024-10-14 09:44:17 -03:00
Boris Nagaev f485e079b7 chanbackup: add backup version for TapscriptRoot
Previous to this change taproot assets channels and simple taproot channels were
considered the same in the context of chanbackup package, since they stored the
same data. In the following commits we are adding the data needed to produce a
signed commitment transaction from a SCB file and in order to do that we need to
add more fields and a custom channel gets one additional field (TapscriptRoot)
compared to a simple taproot channel. So now we have to distinguish these kinds
of channels in chanbackup package.

See PR https://github.com/lightningnetwork/lnd/pull/8183 for more details.
2024-10-11 10:00:42 -03:00
Boris Nagaev 90c45ddd8f lnwallet: factor out func GetSignedCommitTx
This pure function creates signed commit transaction, using various
inputs passed as struct TaprootSignedCommitTxInputs and a signer.

This is needed to be able to store the inputs without a signature
in SCB and sign the transaction in chantools scbforceclose.

See https://github.com/lightningnetwork/lnd/pull/8183/files#r1423959791
2024-10-11 10:00:42 -03:00
Boris Nagaev e7776a4c1e contractcourt: fix doc of commitSweepResolver
It is used for sweeping time-locked outputs as well as non time-locked outputs.
2024-10-11 10:00:42 -03:00
Boris Nagaev e04aaa0de0 chanbackup: test encoding of taproot channel 2024-10-11 10:00:42 -03:00
Boris Nagaev a1aec88268 [lncli] exportchanbackup single channel in hex
It used to be base64, which is not compatible with verifychanbackup,
expecting hex.
2024-10-11 10:00:42 -03:00