Commit Graph

139 Commits

Author SHA1 Message Date
Oliver Gugger
4140d2a9d7
lnrpc: re-generate protos after dependency update 2024-03-14 09:32:29 +01:00
Keagan McClelland
db39a905cb multi: make NewChanIDFromOutpoint accept value instead of pointer 2024-03-08 15:47:55 -08:00
tdb3
3288490df3
lnrpc: Clarify payment_addr and payment_secret
Fix #7438, adding clarification statements in lnrpc proto files.
Originally proposed by daredevil3435 in PR #7873 and PR #7885.
2024-02-13 19:04:18 -05:00
Mohamed Awnallah
1402ffd17b
protolint: configure protolint and fix the protolinting issues
This PR addresses the following:
- Install and Configure protolint to enforce the protobuf style guide rules in the CI.
- Fix the protolinting issues (package and import ordering) while maintaining the comaptibility.
2024-01-22 22:00:00 +02:00
Keagan McClelland
bba09e320c lnrpc: add invoicesrpc doc tags to enable lncli api doc generation 2023-11-20 14:41:54 -07:00
Elle Mouton
0e82293e45
multi: address linter issues 2023-11-08 14:50:35 +02:00
Elle Mouton
84cdcd6847
multi: move DB schemas to channeldb/models
This commit moves the ChannelEdgePolicy, ChannelEdgeInfo,
ChanelAuthProof and CachedEdgePolicy structs to the `channeldb/models`
package.
2023-11-08 14:50:35 +02:00
András Bánki-Horváth
ad5cd9c8bb
multi: extend InvoiceDB methods with a context argument (#8066)
* multi: extend InvoiceDB methods with a context argument

This commit adds a context to InvoiceDB's methods. Along this refactor
we also extend InvoiceRegistry methods with contexts where it makes
sense. This change is essential to be able to provide kvdb and sqldb
implementations for InvoiceDB.

* channeldb: restrict invoice tests to only use an InvoiceDB instance

* docs: update release notes for 0.18.0
2023-10-11 13:42:59 +02:00
positiveblue
49e099f0a0
lnrpc: run make rpc
The docker image have been updated so we are using another protobuf
version to generate the files. The generate files include the version of
the compiler used to creating them, so we need this commit to pass the
`rpc-check` step in our CI.
2023-09-05 10:11:51 -07:00
Torkel Rogstad
681e3ceede
rpc: verify address is for correct net
Verify that the addresses we're decoding when sending coins onchain are
for the correct network. Without this check we'll convert the users
addresses to their equivalent on other networks, which is a gross
violation of the principle of least astonishment.
2023-06-13 11:58:34 +02:00
Oliver Gugger
c2d2d448fb
Merge pull request #7486 from sangaman/amt-paid-accepted
lnrpc: update docs for invoice amt_paid
2023-05-12 12:26:15 +02:00
Oliver Gugger
ea8fe6f3f3
mod+lnrpc: bump google.golang.org/protobuf to v1.30.0 2023-05-11 22:52:00 +02:00
Eval EXEC
cbcbddfe29
rpcserver: add time_lock_delta overflow check 2023-03-23 21:34:12 +08:00
Daniel McNally
9cc9e40b89
lnrpc: update docs for invoice amt_paid
This corrects the documentation for the `amt_paid` and `amt_paid_msat`
fields on the `Invoice` message to indicate that the fields will be set
if the state of the invoice is either accepted or settled, not only
settled. This reflects the actual behavior of lnd, as demonstrated in
the below `lncli` output:

```
"amt_paid": "10000",
"amt_paid_sat": "10",
"amt_paid_msat": "10000",
"state": "ACCEPTED",
```
2023-03-06 20:23:25 -05:00
Elle Mouton
2fd4f3f180
go.mod+lnrpc+github: point to latest kvdb changes
Use kvdb package v1.4.1. This update also forced the protobuf version to
be bumped which required `make rpc` to be run to update the generated
files. This also required a bump in the github pinned dependencies
config for the grpc and protobuf libs.
2023-01-25 14:03:00 +02:00
positiveblue
8563e1f409
channeldb/invoices: add IsAMP and IsKeysend helpers
The only way to know if an invoice is AMP, Keysend, etc is to look at
its shape/characteristics. This commit adds a couple of helper functions
to encapsulate the logic of these checks.

If all these types cannot intersect: an invoice cannot be AMP and
Keysend or Keysend and Bolt12, etc it could be useful to add an extra
field to store this information instead of relying on checking how the
invoice looks like.
2023-01-20 03:43:39 -08:00
positiveblue
5ff5225245
multi: break invoice depenency on channeldb
Now that we have the new package `lnd/channeldb/models` we can invert the
depenency between `channeldb` and `invoices`.

- Move all the invoice related types and errors to the
`invoices` package.

- Ensure that all the packages dealing with invoices use the types and
  interfaces defined in the `invoices` package.

- Implement the InvoiceDB interface (defined in `lnd/invoices`) in
  channeldb.

- Add new mock for InterfaceDB.

- `InvoiceRegistery` tests are now in its own subpacakge (they need to
  import both invoices & channeldb). This is temporary until we can
  decouple them.
2023-01-16 07:31:09 -08:00
bruwbird
71f2615190
lnrpc: update invoice request expiry comment 2023-01-12 09:17:34 +09:00
Tommy Volk
372333fd2b
lnrpc: clarify proto documentation for Invoice 2022-12-05 20:01:27 +08:00
Oliver Gugger
e7170ef819
Merge pull request #7135 from st4rgut24/revise-addinvoice-help-text
revise help text for addinvoice lncli command
2022-11-18 18:43:58 +01:00
alpeb-btc
eefe1c816e
lnrpc+cmd: clarify docs about addinvoice no-amount hop hints
Add additional comment to `lnclic addinvoice`'s `--private` flag warning
about including a large number of private channel hints when using zero
ammounts.

Also added a comment to the `private` field in the `Invoice` proto
message.
2022-11-12 05:01:10 -05:00
alpeb-btc
0cae501009
lnrpc: provide hop hints when adding an invoice with no amount
With this change we allow adding hop hints when adding an invoice, even
if its amount is zero.

A couple of new unit test case have been added, and the
`testInvoiceRoutingHints` itest was expanded to account for this
scenario.
2022-11-12 05:01:10 -05:00
alpeb-btc
e68ae33c9a
lnrpc: refactor populateHopHintsTestCases in addinvoice_test.go
Extract into a separate function the steps to set up the two-channel
mock, to be reused in other cases.
2022-11-12 05:01:09 -05:00
alpeb-btc
143111e368
lnrpc: fix typos in addinvoice_test.go 2022-11-12 05:01:09 -05:00
st4rgut24
8d6d1564c0 cli: revise help text for addinvoice lncli command [skip ci] 2022-11-11 14:31:04 -08:00
positiveblue
4b0bc9a7c6
invoicesrpc: unit tests for invoice hop hints 2022-09-30 06:55:16 -07:00
positiveblue
fbe79811cf
invoicesrpc: refactor addinvocie hop hint selection
In order to reduce the number of calls to the db we try to process as
few channels as we can + try to not do extra work for each of them.

- First fetch all the channels. Then, filter all the public ones and
  sort the potential candidates by remote balance.

- Filter out each potential candidate as soon as possible.

- Only check the alias if the channel supports scid aliases.

- Because we sort the channels by remote balance, we will hit the
  target amount, if possible, as soon as we can.

We do not want to leak information about our remote balances, so we
shuffle the hop hints (the forced ones go always first) so the invoice
receiver does not know which channels have more balance than others.
2022-09-30 06:55:10 -07:00
positiveblue
0e803172d6
style: format invoicesrpc/addinvoice.go 2022-09-28 02:19:55 -07:00
Evan Kaloudis
981f8969b4
lnrpc/gen_protos.sh: remove js build tag 2022-09-07 18:32:05 -04:00
Olaoluwa Osuntokun
b3998ddb5c
lnrpc: re-compile protos w/ Go 1.19 2022-08-24 11:43:00 -05:00
yyforyongyu
0735522194
multi: fix make fmt 2022-08-23 22:10:24 +08:00
Martin Habovštiak
b4647bc37f doc: Deprecation reason of settled on Invoice
This documents how to deal with `settled` being deprecated. It took me quite a bit of digging without such documentation.

[skip ci]
2022-08-02 11:04:01 +02:00
eugene
0ba67015da
rpcserver+invoicesrpc: alias-aware AddInvoice,AddHoldInvoice rpc
AddInvoice,AddHoldInvoice now issue invoices that include our
peer's aliases. Some extra sanity checks are included to ensure we
don't leak our confirmed SCID for a private channel.
2022-07-07 17:10:29 -04:00
ErikEk
26ba01a5cb doc: subscribe/cancel/lookup invoices rest 2022-06-26 07:15:27 +02:00
priyanshiiit
1e0a271ddb lnrpc: improves invoice documentation [skip ci] 2022-06-14 15:56:36 +05:30
positiveblue
d4021c5aca
lnrpc: fix log.go files
The `log.go` file of each subserver is a copy and paste of the others.
All of them have the same typo, an extra space in a comment, and the
the definition of a function not used anywhere.
2022-04-01 18:12:59 -07:00
Oliver Gugger
7dfe4018ce
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Oliver Gugger
dfdc2bff8b
multi: run gosimports 2022-02-10 11:02:01 +01:00
carla
0092c731e5
lnrpc: limit hop hint selection in both passes by amount + count
Previously, we'd always add up to the maximum number of hop hints
(and beyond!) when selecting hop hints in our first pass. This
change updates hop hint selection to always stick to our hop hint
limit, and to the "hop hint factor" that we scale our invoices by.

This change will result in selecting fewer channels in our first
pass if their total inbound capacity reaches our hop hint factor.
This prevents us from revealing as many private channels as
before, but has the downside of providing fewer options for
payers.
2022-02-07 09:04:30 +02:00
carla
5836d58a99
lnrpc: add unit test covering too many hop hints 2022-02-07 09:03:10 +02:00
carla
714a1fb05c
invoicerpc: move hop hint to constant and add tests to select hop hint 2022-01-27 15:09:21 +02:00
carla
80bf4bf014
invoicerpc: return hop hints from select hop hint rather than functions
Update SelectHopHints to return a set of hop hints that can be
converted to route hints / functional options by the caller. This
change allows external code to call SelectHopHints to get a set of
route hints and use them as it likes, rather than limiting the
return value to functional options for invoice creation.
2022-01-27 15:09:20 +02:00
carla
00a47740c8
invoicesrpc: pass in specialized config for select hop hints 2022-01-27 15:09:19 +02:00
carla
56e83de9ef
invoicesrpc: add HopHintInfo decoupling hop hint from channel internals 2022-01-27 15:09:18 +02:00
yyforyongyu
df2ecd6bc5
invoices: refactor invoice subscriptions to avoid blocking
This commit fixes a potential blocking when notifying invoice updates.
When a new subscription client is created followed by an immediate
cancel, it's likely the client will be removed from the registry's
map(noop) and then added to its map again. This subscription will then
be kept in registry until lnd is restarted. Another more serious issue
is when multiple subscriptions are made for the same invoice, when the
above case happens, other subscriptions may never send invoice updates
because a previous client has a stopped notification queue that blocks
following notifications.
2021-12-15 02:38:51 +08:00
Olaoluwa Osuntokun
698b5a8079
lnrpc: populate new AmpInvoiceState field in CreateRPCInvoice 2021-10-28 15:50:20 -07:00
Olaoluwa Osuntokun
d8ce00e016
lnrpc/invoicesrpc: expose new lookup modifier to LookupInvoiceV2 2021-10-28 15:50:17 -07:00
Olaoluwa Osuntokun
8299d632e8
lnrpc/invoicesrpc: add new invoice ref LookupInvoiceV2 method
In this commit, we add a new `LookupInvoiceV2` method attached to the
invoice RPC sub-server. Compared to the existing version, this version
allows an invoice to be looked up by an invoice ref. This enables users
to query an AMP invoice based on a specific _set ID_, so they can get
the information related to the set of cumulative settles to that
invoices.
2021-10-28 15:49:25 -07: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