Commit Graph
100 Commits
Author SHA1 Message Date
Oliver Gugger d581cd02fc chanfunding: extract FinalizeRawTX into own method
As a preparation to also allow the final TX to be specified in the raw
wire format, we extract the check of the final transaction into its own
method.
2020-09-15 08:30:22 +02:00
Oliver Gugger 154dc1af66 lncli: allow final transaction as raw hex in PSBT funding flow 2020-09-15 08:30:21 +02:00
Oliver Gugger c4ada8a592 lnrpc: add final raw TX to PSBT finalize 2020-09-15 08:30:21 +02:00
Oliver Gugger 7f68649b44 mod: update btcwallet and psbt library version 2020-09-15 08:29:56 +02:00
Oliver Gugger 9ea836c237 Merge pull request #4614 from guggero/printmacaroon-fix
lncli: print all permission actions
2020-09-14 13:41:05 +02:00
Oliver Gugger 384ab9f616 lncli: print all permission actions
Due to a misunderstanding about how the entities/actions are encoded
inside the macaroon, only the first action was printed per entity.
Even though we add them as separate pairs in the macaroon service (for
example "offchain:read" and "offchain:write"), they are grouped in the
serialized macaroon ("offchain:read,write").
2020-09-14 10:55:19 +02:00
Oliver Gugger 061040c57b rpcserver: export MainRPCServerPermissions
To be able to properly delegate requests to the correct component in LiT we
need to know all URIs of lnd and the other subservers.
2020-09-10 10:25:38 +02:00
Oliver Gugger 8988a01d7e lnd+rpcserver: allow external subservers to specify macaroon validator
Give the external subservers the possibility to also use their own
validator to check any macaroons attached to calls to their registered
gRPC URIs.
This allows them to have their own root key ID database and permission
entities.
2020-09-10 10:24:10 +02:00
Oliver Gugger c3227057f4 macaroons: allow external validators to be registered
When external subservers register themselves to be served through the
same gRPC interface as the main lnd RPC, their requests are also
intercepted by the main lnd macaroon interceptor.
If the external subservers want to use their own macaroons that are
independent of lnd's, they need a way to overwrite the default validator
of the macaroon interceptor. We add this mechanism with the concept of
external validators.
2020-09-10 10:24:09 +02:00
Oliver Gugger d4c4cf01f0 lnd+macaroons: specify location when creating macaroon service
To allow the macaroon service to be used in other projects, we want the
location to be passed in as a parameter instead of being hard coded.
2020-09-10 10:24:08 +02:00
Oliver Gugger 8668248d96 Merge pull request #4310 from guggero/lncli-profiles
lncli: add profiles for easy multi-node management
2020-09-09 09:00:27 +02:00
Oliver Gugger d792a8ef61 lncli: use readPassword function everywhere 2020-09-07 15:55:05 +02:00
Oliver Gugger 070cfb804f lncli: use profiles 2020-09-07 15:55:04 +02:00
Oliver Gugger a2721a15a8 lncli: use CleanAndExpandPath from lncfg 2020-09-07 15:55:04 +02:00
Oliver Gugger 10f73b3b91 lncli: add new profile commands
We add a new 'profile' sub command to lncli to manage pre-defined
configuration profiles for all of lncli's CLI flags.
2020-09-07 15:55:04 +02:00
Oliver Gugger e2c14edd7b lncli: add struct to hold profile configuration
A profile file can contain multiple profile entries. Each
entry has a name, a set of default options to use and an optional list
of macaroons in a jar. The profile file can be
serialized/deserialized to and from JSON.
2020-09-07 15:23:17 +02:00
Oliver Gugger c34732af3d lncli: add encrypted macaroon jar
With this commit we add a simple macaroon jar that can encrypt its
content with a user-provided password when being serialized to JSON.
2020-09-07 15:23:12 +02:00
Oliver Gugger 907c744189 build: bump version of master branch to v0.11.99-beta 2020-09-07 15:06:07 +02:00
Oliver Gugger d33f87493e routerrpc: pass in probability source 2020-09-04 16:39:52 +02:00
Oliver Gugger b4bf4b2906 Merge pull request #4463 from guggero/macaroon-custom-permissions
Advanced macaroons 1/2: Custom URI permissions
2020-09-04 11:42:42 +02:00
Oliver Gugger 4996b28dab lnrpc+lncli: add command to print macaroon 2020-09-04 09:50:42 +02:00
Oliver Gugger 3ce7f72cd4 lncli: add new listpermissions command 2020-09-04 09:50:41 +02:00
Oliver Gugger 830ce163c6 lncli: add new URI permissions to bakemacaroon 2020-09-04 09:50:41 +02:00
Oliver Gugger 295bd44fea itest: test custom permissions 2020-09-04 09:50:41 +02:00
Oliver Gugger decd2d975c itest: parallelize test steps 2020-09-04 09:50:40 +02:00
Oliver Gugger 9862ee7cd6 itest: extract connection setup 2020-09-04 09:50:40 +02:00
Oliver Gugger 17276e9a7f itest: use only one timeout context
All these operations should be very fast and can be done in just one
timeout context.
2020-09-04 09:50:39 +02:00
Oliver Gugger a929f56781 itest: use require for macaroon tests 2020-09-04 09:50:39 +02:00
Oliver Gugger 906011f278 itest: add _test file name suffix to tests
To fix the compiler of some IDEs complaining about types and functions
it cannot find, we rename all files that contain tests back to lnd_xxx_test.go to make
sure they are compiled correctly.
2020-09-04 09:50:39 +02:00
Oliver Gugger ba6156d41d lnrpc+rpcserver: add ListPermissions RPC
As a convenience method for users to look up what RPC method URIs exist
and what permissions they require, we add a new ListPermissions call
that simply returns all registered URIs (including internal and external
subservers) and their required permissions.
2020-09-04 09:50:38 +02:00
Oliver Gugger 84879fddc6 rpcserver: allow to bake macaroons for specific URIs
To support the new URI specific permissions, we allow them to be added
in the BakeMacaroon call.
2020-09-04 09:22:36 +02:00
Oliver Gugger 6d201ef4fc macaroons: add special permission entity for URI specific permissions
To make the permission system even more fine-grained, we want to allow
users to specify exact gRPC URIs in the macaroon permissions instead of
just broad entity/action groups.
For this we add the special entity "uri" which allows an URI specific
permission to be defined as "uri:/lnrpc.Lightning/GetInfo" for example
instead of the more coarse "info:read" which gives access to multiple
URIs.
2020-09-04 09:22:35 +02:00
Oliver Gugger 6055b00dbb Merge pull request #4580 from guggero/fundingmgr-mutex
fundingmanager: hold lock during loop
2020-08-31 14:34:51 +02:00
Oliver Gugger 199336a342 fundingmanager: hold lock during loop
As a follow-up to #4560 we actually need to hold the reservation mutex
during the full loop where we count the pending reservations. Otherwise
the results might become inaccurate for concurrent funding flows.
2020-08-31 09:15:01 +02:00
Oliver Gugger e4764a67cc Merge pull request #4560 from guggero/abandon-shim-chans
Shim funded channels: don't count towards max pending channels, allow to abandon them
2020-08-28 14:41:45 +02:00
Oliver Gugger 7a15131715 Merge pull request #4573 from yyforyongyu/small-fix
trivial: remove unused print
2020-08-28 13:05:39 +02:00
Oliver Gugger 4346a1a3c6 itest: test max pending and abandon channel for shim chans
We change the external funding test to now test two more things: First
that we can open multiple externally funded channels without needing to
lift the default --maxpendingchannels setting. Then we test that we can
use the safer pending_funding_shim_only flag of the AbandonChannel RPC
to get rid of the never confirming external channels.
2020-08-28 12:28:59 +02:00
Oliver Gugger 8ed0efed0b itest: use NoError in external funding tests 2020-08-28 12:28:59 +02:00
Oliver Gugger aa6e3f6d01 itest: extract deriveFundingShim
As a preparation to test accepting multiple externally funded channels
at the same time, we extract the deriveFundingShim function from the
external funding integration test.
2020-08-28 12:28:59 +02:00
Oliver Gugger 3caca4fa3f lnrpc+rpcserver: enable abandonchannel for externally funded chans
To make sure we can use the abandonchannel RPC for getting rid of
externally funded channels who's funding transaction was never
published, we allow the RPC to be used on non-dev builds for externally
funded and pending channels only.
2020-08-28 12:28:58 +02:00
Oliver Gugger f2e0ed19ff lnwallet+fundingmgr: ignore shim channels in pending count
Externally funded channels are expected by the user and explicitly
registered through the use of a funding shim and should therefore not
count towards the max pending channel count which is primarily there to
mitigate DoS attacks.
2020-08-28 12:28:43 +02:00
Oliver Gugger fac3c84806 Merge pull request #4551 from gkrizek/cors
lnd: Add CORS support to the WalletUnlocker proxy
2020-08-25 09:31:40 +02:00
Oliver Gugger a268314d1b Merge pull request #4565 from guggero/update-cert
mod: update cert to v1.0.3
2020-08-24 15:00:55 +02:00
Oliver Gugger d8f1478e5b mod: update cert to v1.0.3
The PR #4421 updated the cert package. To make lnd usable as dependency
in other projects after the PR was merged, we need to tag and update the
cert package.
2020-08-24 10:01:11 +02:00
Oliver Gugger c513d0874e itest: fix pattern for short_chan_id in err whitelist 2020-08-24 09:53:41 +02:00
Oliver Gugger 76cd94c277 lntest: make sure restored chans can't be closed 2020-08-12 16:49:39 +02:00
Oliver Gugger 0655a1bcfb itest: move channel backup tests to own file 2020-08-12 16:06:34 +02:00
Oliver Gugger fe834bc0c0 rpcserver: don't allow closing restored channels
To avoid the scenario where the user tries to force close a channel too
early that was restored through SCB, we check the channel status in the
RPC server already. If a restored channel cannot connect to its peer and
mark it as local data loss the channel arbitrator would try to publish
the commitment TX it does not have and crash.
2020-08-12 16:03:35 +02:00
Oliver Gugger af8ffc9764 lntest: add WS test case with custom header macaroon 2020-08-06 12:11:20 +02:00
Oliver Gugger c7cb2c0a78 docs: describe how to use WebSockets with the REST API
We add a new document that shows two examples of how to use the
WebSocket REST API with JavaScript.
2020-08-06 12:09:15 +02:00
Oliver Gugger c5c28564e9 lnrpc: add macaroon workaround for WebSockets in browsers
For security reasons, browsers are limited in the header fields they can
send when opening a WebSocket connection. Specifically, the macaroon
cannot be sent in the Grpc-Metadata-Macaroon header field as that would
be possible for normal REST requests. Instead we only have the special
field "Sec-Websocket-Protocol" that can be used to transport custom
data. We allow the macaroon to be sent there and transform it into a
proper header field for the target request.
2020-08-06 12:07:07 +02:00
Oliver Gugger 97c73706b5 channeldb: fix for Windows clock resolution
We use the event timestamp of a forwarding event as its primary storage
key. On systems with a bad clock resolution this can lead to collisions
of the events if some of the timestamps are identical. We fix this
problem by shifting the timestamps on the nanosecond level until only
unique values remain.
2020-08-05 09:15:03 +02:00
Oliver Gugger b21b2ebd6f lntest: improve fee calculation in multi-hop test 2020-08-05 09:06:32 +02:00
Oliver Gugger a6a7aca8af travis: add itest on Windows
This commit adds an integration test that runs on a Windows virtual
machine on Travis. The tests run inside of a "Git Bash" environment
which supports the same command line syntax as a proper bash but doesn't
have all the tooling installed. Some tools also behave differently on
Windows. Therefore we also have to simplify the command to upload the
logs to termbin and remove the upload to file.io on Windows because both
the find and tar command don't work as expected.
2020-08-05 09:02:42 +02:00
Oliver Gugger 6115a7b12b make+itest: make itest Windows compatible 2020-08-05 08:53:04 +02:00
Oliver Gugger 2f1f8561ae mod: update to latest btcd version 2020-08-05 08:53:04 +02:00
Oliver Gugger 77fc1ac68f travis: add sanity check stage 2020-07-29 10:16:47 +02:00
Oliver Gugger da447233c8 mod: update to latest x/crypto version w/o broken ARM assembly
This update previously happened in 1589810 but was overwritten again by
a later PR. We need to use a version that doesn't include the broken ARM
assembly for poly1305. We might as well use the latest version of the
library.
2020-07-27 14:15:44 +02:00
Oliver Gugger ecca1f9653 itest: fix flakiness around/startup/reconnect 2020-07-27 14:15:36 +02:00
Oliver Gugger 5d5e6c369d travis: add integration test on ARMv7 (32bit) 2020-07-24 09:49:43 +02:00
Oliver Gugger 17b8b7ea0c github+travis: split CI tasks between Travis and GitHub
To free up build in Travis, we decided to run the non-flaky parts of
the CI pipeline in GitHub Workflows/Actions only. The integration tests
on the other hand are removed from GitHub because individual actions
cannot be restarted there which caused us to restart the whole workflow
if one test was flaky.

This split should give us the best of both worlds: Fast run of small
checks, linting and unit tests with an easy overview of what failed in
the PR directly. And more free build slots on Travis to do more advanced
integration tests on other architectures and/or operating systems. And
the option to restart a single flaky integration test on Travis.
2020-07-23 15:06:05 +02:00
Oliver Gugger 8d2a3ce8ac github: add mobile compilation to GitHub workflow 2020-07-23 15:06:04 +02:00
Oliver Gugger 4ec878e1a2 docs: describe batch funding and --no_publish flag 2020-07-09 14:09:12 -07:00
Oliver Gugger 1a57dfc24c itest: do batch PSBT channel open 2020-07-08 22:19:18 -07:00
Oliver Gugger 563e56987b lncli: add --no_publish to PSBT channel opening 2020-07-08 22:19:17 -07:00
Oliver Gugger 56b916a313 lnwallet: don't publish funding TX if flag set on assembler
The first channels of a batch shouldn't publish the batch TX
to avoid problems if some of the funding flows can't be completed.
Only the last channel of a batch should publish. We set the channel flag
accordingly depending on the flag in the assembler.
2020-07-08 17:13:14 -07:00
Oliver Gugger 258996233f lnwallet+rpcserver: add no_publish flag to PSBT assembler 2020-07-08 17:12:57 -07:00
Oliver Gugger 3a818b9735 lnrpc: add no_publish flag to PSBT shim 2020-07-08 17:12:41 -07:00
Oliver Gugger 1cda467701 lnrpc: explain how to use map types in REST 2020-06-17 08:35:52 +02:00
Oliver Gugger e73c9218d7 itest: add REST API tests 2020-06-17 08:35:51 +02:00
Oliver Gugger 6250ed1cf1 lnrpc: add WebSocket proxy 2020-06-17 08:34:54 +02:00
Oliver Gugger be36776120 Merge pull request #4251 from guggero/rest-2-subservers
REST saga 2/3: Add REST endpoints to all RPCs
2020-06-04 10:26:42 +02:00
Oliver Gugger 19e3dc6378 routerrpc: format proto 2020-06-04 08:50:44 +02:00
Oliver Gugger f48b0289f5 make: check that all RPCs are defined in yaml 2020-06-04 08:50:44 +02:00
Oliver Gugger 558d63718b rpcserver+lnrpc: register REST subservers with root server 2020-06-04 08:50:44 +02:00
Oliver Gugger fe16be5bb8 lnrpc: extract or add REST annotations to yaml 2020-06-04 08:50:00 +02:00
Oliver Gugger 3ef41dd198 lnrpc: update grpc-gateway to v1.14.3 2020-06-04 08:43:49 +02:00
Oliver Gugger 75f916b026 log+config: remove global RootLogWriter variable 2020-05-27 09:43:59 +02:00
Oliver Gugger 70772ab99b config+lnd+rpcserver: use log writer from cfg 2020-05-27 09:43:59 +02:00
Oliver Gugger 42ac187932 peer: fix struct alignment
Integers used atomically MUST be aligned properly, otherwise the
sync library will crash on purpose. Therefore non-aligned struct
members must come later.
2020-05-21 11:28:49 +02:00
Oliver Gugger a17ddc5dd1 channeldb+htlcswitch: don't use fastsha256 in tests
The btcsuite/fastsha256 registers itself in the crypto package of
golang as a replacement for sha256. This causes problems in TLS1.3
connections that require the hash implementations to be serializable
and results in the "tls: internal error: failed to clone hash" error.
By removing all uses of the library we fix that error.
2020-05-20 11:07:38 +02:00
Oliver Gugger 3afaed8b5c rpcserver: fix linter error 2020-05-20 09:12:53 +02:00
Oliver Gugger 36b90382d3 lnd+server+keychain: remove unused code 2020-05-20 09:07:21 +02:00
Oliver Gugger 08d6a61e2a signrpc: use DigestSigner interface for signing 2020-05-20 09:06:59 +02:00
Oliver Gugger 4003f25281 signrpc: use ECDH interface for shared key generation 2020-05-20 09:06:58 +02:00
Oliver Gugger f97e7b9951 watchtower: use ECDH interface for watchtower session 2020-05-20 09:06:57 +02:00
Oliver Gugger 535a22c590 server+brontide: use ECDH interface for brontide handshake 2020-05-20 09:06:56 +02:00
Oliver Gugger ee74e4ba86 server+mod: use ECDH interface for sphinx router 2020-05-20 09:05:36 +02:00
Oliver Gugger be890ef9be lnd+server+netann: use signing interface in node signer 2020-05-20 09:05:35 +02:00
Oliver Gugger 6f702a43aa watchtower: extend and rename SecretKeyRing 2020-05-20 09:05:15 +02:00
Oliver Gugger b0cb110e86 watchtower: rename SessionPrivKey to SessionKeyECDH 2020-05-20 09:05:15 +02:00
Oliver Gugger 140731af00 lnd+watchtower: rename NodePrivKey to NodeKeyECDH 2020-05-20 09:05:14 +02:00
Oliver Gugger 7f1b865b53 multi: rename server's identityPriv to identityECDH 2020-05-20 09:05:14 +02:00
Oliver Gugger cf0380ac81 keychain: add single key wrapper implementations 2020-05-20 09:04:05 +02:00
Oliver Gugger 6cf1844b0e keychain: add new interface methods to wallet 2020-05-20 09:04:04 +02:00
Oliver Gugger d6ba0a5b85 keychain: add new abstraction interfaces 2020-05-20 09:04:04 +02:00
Oliver Gugger 4d3bd6f178 Merge pull request #4295 from guggero/fix-queue
mod: update to queue/v1.0.4
2020-05-18 14:51:16 +02:00
Oliver Gugger bd40f73be3 mod: update to queue/v1.0.4 2020-05-18 11:52:49 +02:00
Oliver Gugger 4261d3f5af lnd: remove global cfg variable 2020-05-14 16:18:02 +02:00
Oliver Gugger 50e86f88fe rpcserver+subrpcserver: don't use global cfg 2020-05-14 16:18:02 +02:00