Commit Graph

824 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
d973cf1060
build: upgrade all CI+build infra to Go 1.17 2021-09-29 17:31:34 -07:00
yyforyongyu
16f97e6f41
rpcserver: return total num of fwdPkgs in PendingChannels
This commit adds a new field, NumForwardingPackages, in the
PendingChannels RPC response to specify how many forwarding packages the
channel has.
2021-09-23 13:23:13 +08:00
Olaoluwa Osuntokun
9264185f5b
Merge pull request #5101 from guggero/macaroon-interceptor
Add macaroon based RPC middleware interceptor
2021-09-20 19:15:04 -07: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
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
ErikEk
46e9481e6c routing: invalid channels updatechanpolicy call 2021-09-15 10:20:49 +02:00
Turtle
72a46b8673
rpcserver: Add flag to BakeMacaroonRequest for allowing external permissions 2021-09-14 16:27:01 -05:00
Turtle
d10a682fa9
macaroons+rpcserver: Add new RPC call for checking macaroon permissions 2021-09-14 16:26:28 -05:00
yyforyongyu
f5bac969e3
rpcperms+rpc: add ServerActive state and set it when server started 2021-09-14 07:34:09 +08:00
Bjarne Magnussen
7f53656753
lnd: add DeletePayment to the RPC
The RPC DeletePayment allows deleteing  single payment from its ID. When calling with `FailedHtlcsOnly` set in the request only failed HTLCs of this payment will be deleted.
2021-09-13 12:50:40 +02:00
Harsha Goli
e4891a98fd
invoicesrpc: expose selectHopHints
selectHopHints is the function which constructs hophints otherwise found
in an invoice created with the private flag.

In this commit, we expose that functionality a little more to workaround
needing to create an invoice to retrieve routing hints. Of course, this
is not a perfect solution as the functionality is exposed exclusively to
go users.
2021-09-06 15:39:53 -07:00
Andras Banki-Horvath
c5c956bbef
lnrpc: add BatchOpenChannel RPC 2021-09-02 12:13:47 +02:00
Oliver Gugger
ae2e9541a4
walletrpc: export wallet kit sub server name
We'll want to re-use the PSBT funding functionality from the wallet kit
sub server in the main RPC server. To be able to dynamically obtain an
instance of the wallet kit server we need to know its name under which
it registers itself in the list of sub server. We export the name so we
don't have to hard code it in the main server.
2021-09-02 12:13:46 +02:00
Oliver Gugger
7c41d4b349
lnrpc: add batch channel open RPC types 2021-09-02 12:11:10 +02:00
Olaoluwa Osuntokun
5a9f499dd5
rpc: add new commitment_type field to OpenChannelRequest
This field will be examined later down the stack along with the set of
feature bits to determine if explicit channel commitment type
negotiation is possible or not.
2021-08-30 19:17:28 -07:00
Olaoluwa Osuntokun
844874252f
Merge pull request #5676 from ErikEk/chainnotifier-remove-error-log
chainnotifier: remove error logs
2021-08-30 18:35:12 -07:00
ErikEk
c68a508535 chainnotifier: remove error log 2021-08-28 00:13:37 +02:00
Olaoluwa Osuntokun
00d275d9f0
lnrpc+rpc: expose last ping message received by peer over ListPeers resp 2021-08-25 16:47:17 -07:00
Oliver Gugger
6d70468ad5
lnrpc: add extended master key to walletunlocker 2021-08-23 11:26:00 +02:00
Joost Jager
925229f9df
walletrpc+lncli: allow zero output psbt funding
To support the cpfp fee bump use case where no external outputs are
required.
2021-08-16 08:41:50 +02:00
Oliver Gugger
06a693f10e
lnrpc+rpcserver: add new fully resolved chan update event
This commit adds the new channel update event for a channel that is now
fully resolved to the event subscription RPC.
2021-08-09 13:55:34 +02:00
Oliver Gugger
ea8c0abaaf
Merge pull request #5601 from guggero/falafel-js-stubs
lnrpc: add JSON stubs for interacting with lnrpc from a WASM context
2021-08-05 09:37:25 +02:00
Oliver Gugger
9138c8abac
multi: rename local and remote chan DBs
As a preparation to not have a local and remote version of the database
around anymore, we rename the variables into what their actual function
is. In case of the RPC server we even directly use the channel graph
instead of the DB instance. This should allow us to extract the channel
graph into its own, separate database (perhaps with better access
characteristics) in the future.
2021-08-04 14:55:50 +02:00
Oliver Gugger
702f0d7ced
lnrpc: generate JSON/WASM client stubs 2021-08-03 13:44:36 +02:00
Oliver Gugger
dd749fe580
lnrpc: update grpc-gateway library to v2 2021-07-27 13:09:59 +02:00
Oliver Gugger
235efc04e4
docs+lnrpc: rename rpc.proto to lightning.proto
To avoid a naming conflict with etcd, we rename our very generic
rpc.proto to lightning.proto to match the service name that's declared
within. This will break many external tutorials and possibly also our
API docs but the change needs to be done eventually.
2021-07-27 12:59:56 +02:00
Oliver Gugger
62888894d2
walletrpc: add missing REST body annotation
The missing body annotation caused the library to ignore any parameters
sent to this RPC endpoint when using the REST proxy.
2021-07-27 12:59:55 +02:00
Oliver Gugger
4a0025c1b7
lnrpc: split REST annotations into service files
As a preparation for the migration to the grpc-gateway/v2 library we
declare each service's REST annotations in its own file. This is
optional in the v1 library but mandatory in v2.
2021-07-27 12:59:52 +02:00
Andras Banki-Horvath
6d80ddfe91
routing: store missioncontrol state in blocks and eliminate cursor use
This commit changes missioncontrol's store update from per payment to
every second. Updating the missioncontrol store on every payment caused
gradual slowdown when using etcd.
We also completely eliminate the use of the cursor, further reducing
the performance bottleneck.
2021-07-26 17:02:11 +02:00
Johnny Holton
9ff4b9b652 Fix typos in dest_custom_records comment 2021-07-22 21:41:38 -04:00
ErikEk
850dee37ee invoices: return payment address from addholdinvoice 2021-07-19 17:05:03 +02:00
Olaoluwa Osuntokun
db3819fcef
Merge pull request #5236 from offerm/preimage-to-settleevent
feature: expose preimage in forward+settle event
2021-07-09 14:35:11 -07:00
Olaoluwa Osuntokun
1287328678
Merge pull request #5335 from guggero/abandonchannel-no-dev
RPC/CLI: Allow abandonchannel to be used in regular build
2021-06-23 16:05:34 -07:00
offerm
2c4dbfa19f feature: expose preimage in forward+settle event
Until now, clients of SubscribeHTLCEvents didn't have access to the settled preimage. The API allows to intercept forward event and to be updated on forward events however the forward+settle event does not include the payment preimage. This pr changes allows it.
2021-06-15 22:01:24 +03:00
de6df1re
c0c0673356
lnrpc: fix v1 switch API doc 2021-06-10 16:55:00 -05:00
Olaoluwa Osuntokun
22b1008916
Merge pull request #5343 from kaloudis/patch-1
Fix typo on FundPsbt fee definition error
2021-05-31 13:05:26 -07:00
Evan Kaloudis
8d5a3d6bb9
Fix typo on FundPsbt fee definition error 2021-05-30 14:28:59 -04:00
Conner Fromknecht
4bb6cc9cee
lnrpc/addinvoice: bump default LND invoice timeouts
Increases the default MPP expiry from 1 hour to 1 day. For the new AMP
invoices, we increase the interval to 1 month. The longer time frames
for AMP invoices is used so that the invoice can be pseudo reused as
implemented in the prior commit.

The BOLT 11 default of 1 hour is still preserved whenever the field is
missing in the payment request itself, but as of this commit the field
will always be set by lnd.
2021-05-28 09:30:06 -07:00
Conner Fromknecht
d6f88cbe6f
lnrpc: allow payment addr override for AMP invoices
This permits an AMP invoice to be "pseudo-reusable", where the invoice
paramters can be used multiple times so long as a new payment address is
supplied. This prevents additional round trips between payer and payee
to obtain a new invoice, even though the payments/invoices won't be
logically associated via the RPC interface like they would when the full
reusable invoices are deployed.
2021-05-28 09:30:05 -07:00
Oliver Gugger
2e9dd0bcf2
lnrpc+rpcserver: allow abandonchannel to be used in regular build
An often requested feature is to use the abandonchannel API in regular
builds and not only dev builds to get rid of stuck channels that had
their funding transaction invalidated.
The initial reason for putting the call behind the build flag was a
safety concern to make sure nobody uses this on active channels by
accident.
2021-05-26 22:51:41 +02:00
Olaoluwa Osuntokun
c18f3333d8
Merge pull request #5247 from joostjager/deprecate-chan-capacity
lnrpc: deprecate route hop channel capacity field
2021-05-19 17:06:15 -07:00
Oliver Gugger
3eb7539de1
lnrpc: fix typos in REST annotations for routerrpc
Fixes #5307.
Corrects some typos in the REST annotations for the routerrpc subserver.
Unfortunately these mistakes aren't caught by the current version of the
grpc-gateway library. But we intend to update to v2 soon which will
output alerts as mentioned in #5307.
2021-05-19 09:48:33 +02:00
Joost Jager
2749b805b0
lnrpc: deprecate route hop channel capacity field 2021-05-16 11:58:23 +02:00
eugene
a70d0bef34
multi: validate payment params at RPC layer
With this patch, we'll fail out earlier in the cycle in case of
some wonky parameters, and not leave zombie payments in the router
which currently are not cleaned up.
2021-05-13 17:17:52 -04:00
Olaoluwa Osuntokun
dc73a23e81
Merge pull request #5253 from cfromknecht/amp-invoice
Support paying AMP invoices via SendPaymentV2
2021-05-12 13:38:42 -07:00
Conner Fromknecht
64d07558d9
lnrpc: set either payHash or setId depending on payreq type 2021-05-10 22:02:14 -07:00
Conner Fromknecht
8c404ade18
routing: allow splitting for AMP or MPP 2021-05-10 22:02:14 -07:00