Commit Graph
100 Commits
Author SHA1 Message Date
Oliver Gugger b22f51098a rpcperms+lnd: use macaroon service from interceptor chain
We'll refactor the wallet creation and unlock process in a following
commit and want to make it possible to not need a direct reference to
the macaroon service in our main function. Since we store it in the
interceptor chain anyway (if we're using macaroons in the first place),
we might as well use the instance there directly.
2021-10-08 12:06:53 +02:00
Oliver Gugger d12154154a chainreg+lnd: add block cache to chainreg config
The block cache size in the chainreg.Config previously wasn't used but
instead the block cache was passed in as a separate parameter. We
replace the cache size with the actual cache in the config to streamline
things somewhat.
2021-10-08 12:06:53 +02:00
Oliver Gugger e79d59dd4c multi: use key locator for lnwallet.MessageSigner
To simplify the message signing API even further, we refactor the
lnwallet.MessageSigner interface to use a key locator instead of the
public key to identify which key should be signed with.
2021-10-08 12:06:52 +02:00
Oliver Gugger afa03f22cc multi: use key locator only for signing messages
To simplify the API surface of a remote signer even more, we refactor
the SignMessage and SignMessageCompact calls to only accept a key
locator as we always know what key we're using for signing anyway.
2021-10-08 12:06:52 +02:00
Oliver Gugger 8b7c88537c multi: refactor SignDigestCompact into SignMessageCompact
To make it possible to use a remote lnrpc server as a signer for our
wallet, we need to change our main interface to sign the message instead
of the message's digest. Otherwise we'd need to alter the
lnrpc.SignMessage RPC to accept a digest instead of only the message
which has security implications.
2021-10-08 12:06:52 +02:00
Oliver Gugger 02757f6735 multi: refactor SignDigest into SignMessage
To make it possible to use a remote signrpc server as a signer for our
wallet, we need to change our main interface to sign the message instead
of the message's digest. Otherwise we'd need to alter the
signrpc.SignMessage RPC to accept a digest instead of only the message
which has security implications.
2021-10-08 12:06:51 +02:00
Oliver Gugger dd3719d5de Merge pull request #5832 from guggero/node-feature-log
channeldb: fix graph cache feature handling
2021-10-08 10:02:44 +02:00
Oliver Gugger 77bf6cfed3 channeldb: fix graph cache feature handling [skip ci]
Fixes #5830.
When a channel for a node is announced before the node itself is
announced on the network, it's possible that we have channels for a node
but no features defined yet. This was previously logged as a warning
which spammed the log unnecessarily.
2021-10-08 10:02:11 +02:00
Oliver Gugger c30152c1c0 Merge pull request #5842 from hsjoberg/gomobile-ios-xcframework
build: make gomobile iOS build to .xcframework folder
2021-10-08 09:58:03 +02:00
Oliver Gugger 0d2ea30ada docs: add release notes 2021-10-07 14:26:00 +02:00
Oliver Gugger 0fac6c400e itest: wait for node to fully start up 2021-10-06 16:29:49 +02:00
Oliver Gugger e9c9ec2e84 itest: exit goroutines on error 2021-10-06 16:29:44 +02:00
Oliver Gugger b925ebb92c GitHub: only upload logs on failure 2021-10-06 16:29:44 +02:00
Oliver Gugger 134be244b4 GitHub+Travis: move itests to GitHub Actions 2021-10-05 20:48:48 +02:00
Oliver Gugger c89637a4e2 itest: fix close of closed channel panic 2021-10-05 20:48:48 +02:00
Oliver Gugger 1774934666 multi: fix Postgres on Travis
Fixes the docker build that was caused by
https://github.com/docker-library/postgres/issues/884.
Using the alpine and version 13 image avoids the problem introduced
with postgres 14 and debian bullseye.
2021-10-05 20:48:48 +02:00
Oliver Gugger 6bc0862fdf itest: fix commitment_deadline context expired flake 2021-10-05 20:48:48 +02:00
Oliver Gugger bedba02a2d itest: enable slow mining by default
We now redirect the mineBlocks function to the mineBlocksSlow function
which waits after each mined block. To reduce the overall time impact of
using that function everywhere, we only wait 20 milliseconds instead of 50ms
after each mined block to give all nodes
some time to process the block. This will still slow down everything by a bit
but reduce flakes that are caused by different sub systems not being
up-to-date.
2021-10-05 20:48:47 +02:00
Oliver Gugger 98061dfd58 mod+lntest: disable stall handler in btcd mining node
The latest version of btcd allows its stall handler to be disabled. We
use that new config option to make sure the mining btcd node and the lnd
chain backend btcd node aren't disconnected if some test takes too long
and no new p2p messages are exchanged.
2021-10-05 20:48:47 +02:00
Oliver Gugger d688a2a7f5 GitHub: download key from git repo, update Roasbeef's key
With this commit we update the release template to download Roasbeef's
key from the git repository via GitHub.
We also update the key mentioned in the template to the new signing key.
[skip ci]
2021-10-05 10:06:40 +02:00
Oliver Gugger 51d19dad87 Merge pull request #5363 from guggero/psbt-no-final-tx
Allow skipping `PsbtFinalize` step during channel funding to support external broadcast
2021-10-04 12:37:51 +02:00
Oliver Gugger 692ea25295 Merge pull request #5642 from guggero/in-memory-graph
In-memory graph cache for faster pathfinding
2021-10-04 11:20:23 +02:00
Oliver Gugger 3e7df3d20d docs: add release notes 2021-10-04 11:17:58 +02:00
Oliver Gugger bf60b20def docs: add example for PSBT batch funding 2021-10-04 11:17:09 +02:00
Oliver Gugger 57253c0c05 itest: add test for fully external PSBT funding 2021-10-04 11:17:08 +02:00
Oliver Gugger 1608faf199 multi: allow skipping the PSBT finalize step
The FundingPsbtFinalize step is a safety measure that assures the final
signed funding transaction has the same TXID as was registered during
the funding flow and was used for the commitment transactions.
This step is cumbersome to use if the whole funding process is completed
external to lnd. We allow the finalize step to be skipped for such
cases. The API user/script will need to make sure things are verified
(and possibly cleaned up) properly.
2021-10-04 11:17:08 +02:00
Oliver Gugger d4136002c1 lnwallet: only set funding TX witness if we publish
During the final part of the channel funding negotiation we only need to
assemble the full funding TX with the witness if we are going to publish
the transaction ourselves. If the final funding TX is published
externally we don't need this information. This will make it possible to
skip the verify process for fully externally funded PSBT channels.
2021-10-04 11:17:08 +02:00
Oliver Gugger 9b04ae45e3 chanfunding: fix swapped godoc comments 2021-10-04 11:17:07 +02:00
Oliver Gugger fa8e8e6f99 Merge pull request #5761 from naveensrinivasan/naveen/feat/fix-mongo-CVE
mod:replace mongo driver to address CVE-2021-20329
2021-10-04 10:43:20 +02:00
Oliver Gugger c43b9e4fe7 Merge pull request #5759 from naveensrinivasan/naveen/feat/fix-GO-2021-0053
mod:replace gogo/protobuf for GO-2021-0053
2021-10-01 15:45:54 +02:00
Oliver Gugger 036041d671 Merge pull request #5665 from LN-Zap/upstream/feat/single-utxo-reserved
lnd: use change output index from authoring TX to check reserved value
2021-10-01 09:51:28 +02:00
Oliver Gugger 0b4e03f5fc multi: add golang 1.17 compatible build tags
With go 1.17 a change to the build flags was implemented:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

The formatter now automatically adds the forward-compatible build tag
format and the linter checks for them, so we need to include them in our
code.
2021-09-29 17:31:37 -07:00
Oliver Gugger 7aa9661d42 lntest: use errgroup for node startup
This commit fixes a nil pointer issue when a node fails to start up.
Because require.NoErrorf() doesn't abort a test immediately if run
inside a goroutine, this lead to the test continuing with nil node
references which lead to a panic later on.
2021-09-29 17:31:32 -07:00
Oliver Gugger 493262e253 itest: fix flake in update_channel_status itest
This commit fixes a flake in the channel status update itest that
occurred if Carol got a channel edge update for a channel before it
heard of the channel in the first place. To avoid that, we wait for
Carol to sync her graph before sending out channel edge or policy
updates.

As always when we touch itest code, we bring the formatting and use of
the require library up to date.
2021-09-29 17:50:01 +02:00
Oliver Gugger 6240851f93 channeldb: optimize memory usage of initial cache fill
With this commit we use an optimized version of the node iteration that
causes fewer memory allocations by only loading the part of the graph
node that we actually need to know for the cache.
2021-09-29 17:00:06 +02:00
Oliver Gugger a5202a89e6 docs: add release notes 2021-09-29 17:00:05 +02:00
Oliver Gugger a95a3728b5 lnd+channeldb: pre-allocate cache size
To avoid the channel map needing to be re-grown while we fill the cache
initially, we might as well pre-allocate it with a somewhat sane value
to decrease the number of grow events.
2021-09-29 17:00:05 +02:00
Oliver Gugger bf27d05aa8 routing+server: use cached graph interface 2021-09-29 17:00:05 +02:00
Oliver Gugger 1d1c42f9ba multi: use minimal policy in cache 2021-09-29 17:00:04 +02:00
Oliver Gugger 15d3f62d5e multi: use cache for source channels 2021-09-29 17:00:04 +02:00
Oliver Gugger d6fa912188 multi: further decouple graph
To further separate the channel graph from the channel state, we
refactor the AddrsForNode method to use the graphs's public methods
instead of directly accessing any buckets. This makes sure that we can
have the channel state cached with just its buckets while not using a
kvdb level cache for the graph.
At the same time we refactor the graph's test to also be less dependent
upon the channel state DB.
2021-09-29 17:00:03 +02:00
Oliver Gugger ddea833d31 multi: extract address source into interface
As a preparation to have the method for querying the addresses of a node
separate from the channel state, we extract that method out into its own
interface.
2021-09-29 17:00:03 +02:00
Oliver Gugger c1f686f860 channeldb+funding: move opening channel state to DB
The funding manager doesn't need to know the details of the underlying
storage of the opening channel state, so we move the actual store and
retrieval into the channel database.
2021-09-29 17:00:02 +02:00
Oliver Gugger 3385d38414 Merge pull request #5766 from JssDWt/update-csharp-grpc-docs-grpc.net.client
Update C# grpc docs to use Grpc.Net.Client
2021-09-29 12:02:03 +02:00
Oliver Gugger 5aeb728f80 lntest: use errgroup for node startup
This commit fixes a nil pointer issue when a node fails to start up.
Because require.NoErrorf() doesn't abort a test immediately if run
inside a goroutine, this lead to the test continuing with nil node
references which lead to a panic later on.
2021-09-29 11:57:53 +02:00
Oliver Gugger 410606b082 Merge pull request #5797 from guggero/fix-nil-channel
rpcserver: fix nil issue with historical channels
2021-09-28 11:02:12 +02:00
Oliver Gugger e067dc73b7 rpcserver: fix nil issue with historical channels [skip ci]
Fixes #5796.
Some historical channels might not have the forwarding packages
recorded. And since the error might be silenced, the historical channel
might be nil.
2021-09-27 22:26:03 +02:00
Oliver Gugger be2566cf26 Merge pull request #5053 from guggero/verify-count
verify-install: add keys to repo, pin signatures to keys
2021-09-27 18:28:05 +02:00
Oliver Gugger 421add062c docs: add release notes 2021-09-27 15:49:12 +02:00
Oliver Gugger d7d1574095 scripts: verify version in manifest
To make a downgrade attack harder, we also check that the version string
is contained in the manifest, on the same line as the hash.
2021-09-27 15:49:12 +02:00
Oliver Gugger 5bafff2cf2 scripts: allow packaged release archive to be verified
Instead of only allowing to verify installed/unpacked binaries, we also
allow a single binary or packaged release archive to be verified.
2021-09-27 15:49:11 +02:00
Oliver Gugger 5afed8ab62 docker: add keys to docker image
Because the PGP keys are no longer downloaded from Keybase but are used
from the repo directly, we also have to copy them to the Docker image so
we can run the script without needing to supply them through a volume.
2021-09-27 15:49:11 +02:00
Oliver Gugger 6d0368a189 scripts: pin signatures to keys
With this commit we add a new restriction that checks that the
username in the signature file (manifest-<username>-<version>.sig) actually
does have a signing key and that the signature was created with that key.
The signature is only counted towards the minimum of 5 signatures if
that check is successful.
The changes in this commit were inspired by @kixunil in #5048.
2021-09-27 15:49:11 +02:00
Oliver Gugger 0984638a74 scripts: make sure signature files have unique names
To fix a simple attack where the same file would be uploaded multiple
times under the same name, we make sure we only count unique file names.
2021-09-27 15:49:10 +02:00
Oliver Gugger f6c66ca980 scripts: add signing keys to repo
Instead of importing the keys from Keybase, we add all the signing keys
to the repository. In addition to having the key file present each key's
ID must also be added to the verification script. This acts as a double
check that the correct key is added and makes a key change more
explicit.
2021-09-27 15:49:08 +02:00
Oliver Gugger 4c8bf9c28d scripts: extract functions
As a preparation to make the script easier to understand, we extract
some of the sub tasks into functions.
2021-09-27 15:48:19 +02:00
Oliver Gugger f60a1ba0ce Merge pull request #5699 from guggero/lncli-deletepayment
lncli: add deletepayments command
2021-09-27 13:41:41 +02:00
Oliver Gugger 57d203c9f1 docs: add release notes 2021-09-27 12:34:53 +02:00
Oliver Gugger 348405994c cmd/lncli: add deletepayments command
To give the CLI user the option to delete a single or multiple payments
in one command, we expose the DeletePayment and DeleteAllPayments
RPCs to the command line as well. Due to the similarity of the two RPCs
we combine them into a single command with multiple flags.

To make the command a bit more safe to run without arguments, we
consciously switch the logic of the RPC flag "failed_payments_only"
which is false by default into a "--include_non_failed" in the CLI which
is false by thefault. So a user running the command without knowing what
they are doing are only deleting failed payments by default, not all of
the payments.
2021-09-27 12:34:53 +02:00
Oliver Gugger 23d7065655 Merge pull request #5790 from arshbot/add-arshbot-verify
scripts: add arshbot key to verify script
2021-09-27 12:28:58 +02:00
Oliver Gugger 765d043cc0 mod+lncli: remove deprecated package [skip ci]
The use of golang.org/x/crypto/ssh/terminal was marked as deprecated
since that code was moved to its own repo golang.org/x/term.
With this commit we use the new package name directly, which was already
pulled in under its new name anyway.
2021-09-24 09:22:47 +02:00
Oliver Gugger 1d103f1f55 cmd/lncli: group all Mission Control cmds into own file
Having one file per sub command seems a bit too excessive and isn't
really implemented for any of the other commands. So we just group the
Mission Control commands into their own file for now.
2021-09-23 16:59:41 +02:00
Oliver Gugger 28c25d7e9c cmd/lncli: group Mission Control cmds into own category
To make the "Payments" category a bit less overloaded and to move the
Mission Control configuration commands away from the "root" category, we
create the new "Mission Control" category that we move the commands
into. We do this in a single commit so the next one where we move them
into the same file can be a pure code move without any additional
changes.
2021-09-23 16:59:41 +02:00
Oliver Gugger da418ef46b cmd/lncli: move all payment related cmds to single file
With this commit we move all commands that can be found within the
"Payments" category into its own file called cmd_payments.go. The only
exception are the Mission Control related commands which we are going to
move to their own category and file in the next commit.
2021-09-23 16:59:40 +02:00
Oliver Gugger e686a70b96 Merge pull request #5765 from sime/patch-1
docs: Remove pruned node warning.
2021-09-23 09:17:50 +02:00
Oliver Gugger 8d8db52723 Merge pull request #5772 from guggero/use-kvdb-1.0.3
mod: update kvdb to kvdb/v1.0.3 [skip ci]
2021-09-21 15:25:04 +02:00
Oliver Gugger 1ca332c611 mod: update kvdb to kvdb/v1.0.3 [skip ci] 2021-09-21 12:27:42 +02:00
Oliver Gugger 3f7909b48f doc: add release notes 2021-09-20 17:04:39 +02:00
Oliver Gugger 4b43e977b2 lntest: add RPC middleware itests 2021-09-20 17:04:39 +02:00
Oliver Gugger 0cc260bfc7 itest: add _test suffix to test file 2021-09-20 17:04:38 +02:00
Oliver Gugger efe5f6ae90 multi: add RPC middleware interception
With the middleware handler in place, we now need to add a new gRPC
interceptor to the interceptor chain that will send messages to the
registered middlewares for each event that could be of interest to them.
2021-09-20 17:04:29 +02:00
Oliver Gugger 75ca574790 lnrpc+rpcperms: add middleware handler
With this commit we introduce the concept of RPC middleware: A mechanism
similar to the existing channel or HTLC interceptors but this time for
gRPC messages themselves.
An RPC middleware can register itself to the main RPC server to get
notified each time a new gRPC request comes in, a gRPC response is sent
back or a streaming RPC is connected. The middleware can
validate/inspect incoming requests and modify/overwrite outgoing
responses.

Since this also opens the door for malicious software to interfere with
lnd in a negative way, we bind everything to macaroons with custom
caveat conditions: A middleware declares upon registration which custom
caveat name it can handle. Only client requests that send a macaroon
with that custom caveat will then be given to the middleware for
inspection. The only exception is if the middleware instead registers
to use the read-only mode. In that mode it will be able to intercept
all requests/responses, even those not made with a special encumbered
macaroon. But the middleware won't be able to alter responses in the
read-only mode. Therefore requests with the default, unencumbered macaroons
can never be modified by any middleware.
2021-09-20 13:12:49 +02:00
Oliver Gugger 918e021177 config+sample-lnd.conf+lncfg: add RPC middleware config 2021-09-20 13:05:47 +02:00
Oliver Gugger 8509d92070 log+rpcperms: add custom RPCP logger to rpcperms package
The custom RPC middleware logic that we are going to add in the next
commits will need to log under their own sub logger so we add one with a
new subsystem name.
2021-09-20 13:05:47 +02:00
Oliver Gugger 7b822f41df lncli: add custom caveats to bakemacaroon
With the new condition and checker in place, we can give the end user
the ability to add such a custom caveat to a baked macaroon.
There won't be an RPC counterpart for this operation since all first party
caveats currently are only added on the client side.
2021-09-20 13:05:47 +02:00
Oliver Gugger 045765111a multi: use safe copy for macaroons
Fixes #4383 by adding a new SafeCopyMacaroon function that correctly
clones all caveats and prevents modifications on the copy from affecting
the original.
2021-09-20 13:05:46 +02:00
Oliver Gugger 538175f487 macaroons: add custom caveat contraint and checker
The way the macaroon bakery library lnd uses works is that one has to
register a Checker method for each caveat name that should be supported.
Since we want to allow fully customizable custom caveats we add another
layer of naming to the caveat by splitting the condition of the "outer"
caveat into two pieces, the custom caveat name and the actual custom
caveat condition.
The custom Checker function only checks that the format is correct and
that there is a handler available for a custom condition. It does not
check the condition itself, however. If the passed in acceptor signals
acceptance of a custom caveat then the bakery accepts the macaroon as a
whole (given its signature, standard caveats and permissions are all
correct) and assumes that another component down the line will make sure
the actual custom condition of a caveat is valid.
2021-09-20 13:05:46 +02:00
Oliver Gugger 96ea4bf05e rpcserver+macaroons: extract RawMacaroonFromContext
We'll re-use the code for extracting a macaroon from a request context
later on so we extract it into its own exported function.
2021-09-20 13:05:33 +02:00
Oliver Gugger 4b7452a35e lnrpc+itest: fix write deadline issue with WS ping
Fixes #5680.
To make sure we're always reading from the WebSocket connection, we need
to always have an ongoing (but blocking) conn.ReadMessage() call going
on. To achieve this, we do the read in a separate goroutine and write to
a buffered channel. That way we can always read the next message while
the current one is being forwarded. This allows incoming ping messages
to be received and processed which then leads to the deadlines to be
extended correctly.
2021-09-20 12:21:03 +02:00
Oliver Gugger 5f94ebbd7d lnrpc: use request context in WebSocket proxy
The request context was not properly used to pass it along to the gRPC
endpoint which caused streaming calls to still be active on the gRPC
side even if the WS side already hung up.
We also issue an explicit close on the forwarding writer to signal when
the WS side was closed.
2021-09-20 12:07:46 +02:00
Oliver Gugger 29a8661517 Merge pull request #5640 from bhandras/kvdb-prefetch
kvdb+channeld: extend `kvdb` with `Prefetch` for prefetching buckets in one go and speed up payment control by prefetching payments on hot paths
2021-09-20 09:42:18 +02:00
Oliver Gugger d9f0f07142 Merge pull request #5748 from Roasbeef/flake-block-diff
routing: add wait.NoError to TestBlockDifferenceFix assertion [skip ci]
2021-09-20 08:25:27 +02:00
Oliver Gugger 5f43ef5816 Merge pull request #5751 from guggero/use-kvdb-1.0.2
mod: update kvdb to kvdb/v1.0.2 [skip ci]
2021-09-17 15:19:17 +02:00
Oliver Gugger 63233ff66c mod: update kvdb to kvdb/v1.0.2 [skip ci] 2021-09-17 13:08:08 +02:00
Oliver Gugger 583ccfeca4 Merge pull request #5611 from yyforyongyu/itest-flake-chan-open
itest: fix test flakes from open channel not found and tx not found in mempool
2021-09-17 09:51:17 +02:00
Oliver Gugger 44d73d7e3e Merge pull request #5743 from guggero/amp-string-nil
record: fix nil pointer in log string
2021-09-16 20:16:01 +02:00
Oliver Gugger dd3f3e7ce5 record: fix nil pointer in log string 2021-09-16 19:51:03 +02:00
Oliver Gugger 7d012ae581 Merge pull request #5738 from naveensrinivasan/naveen/fix/dns
mod: bump miekg/dns to next version
2021-09-16 09:42:16 +02:00
Oliver Gugger d9534ea108 Merge pull request #5405 from ErikEk/routing-updatechanpolicy-chan-check
routing: report invalid channels in updatechanpolicy call
2021-09-16 09:41:02 +02:00
Oliver Gugger 15ec974b15 Merge pull request #5734 from bhandras/itest_parallelism
build: fix itest parallelism
2021-09-15 20:15:29 +02:00
Oliver Gugger 3c15e3d81a Merge pull request #5686 from yyforyongyu/fix-health-check
healthcheck: quit checking when max attempts are reached
2021-09-15 17:41:44 +02:00
Oliver Gugger 03bce2129b Merge pull request #5732 from ellemouton/returnPingHanglerIfError
peer: return from pingHandler if error
2021-09-15 09:48:17 +02:00
Oliver Gugger 08c9d3fbdd Merge pull request #5304 from orbitalturtle/check-macaroon-rpcs
rpc: Bake and validate macaroons with external permissions
2021-09-15 09:42:38 +02:00
Oliver Gugger 4d89585a2d Travis: reduce ARM itest parallelism to 2
Reduces the number of concurrent tranches of itests running to two on
ARM in an attempt to make the tests less flaky because of very high CPU
usage with the default 4 parallel tranches.
2021-09-14 22:11:25 +02:00
Oliver Gugger 1ea6db1f26 Merge pull request #5725 from bottlepay/fix-amp-itest
lntest/itest: fix SendPaymentAMP test
2021-09-14 22:06:58 +02:00
Oliver Gugger 777abe5ff0 Merge pull request #5716 from guggero/fix-unit-tests
cluster: fix kvdb unit test
2021-09-13 15:59:31 +02:00
Oliver Gugger 55b3802387 cluster: fix kvdb unit test
It looks like #5702 was merged prematurely and broke the kvdb unit
tests.
2021-09-13 14:57:42 +02:00
Oliver Gugger 45343e4454 Merge pull request #5660 from LN-Zap/upstream/feat/delete-payment
add DeletePayment that allows to delete a specific payment or its failed HTLCs
2021-09-13 14:56:51 +02:00
Oliver Gugger 25a53f04f7 Merge pull request #5702 from bhandras/itest_etcd_logs
itest: save etcd logs along node logs in separate files
2021-09-13 11:50:35 +02:00
Oliver Gugger cc939cfa5d Merge pull request #5706 from Liongrass/patch-1
trivial: link from readme to builder's guide [skip ci]
2021-09-10 10:23:44 +02:00