Commit Graph

22 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
174faa7955
lnrpc/invoicesrpc: only try to add hop hints if we have channels 2020-08-13 14:47:27 -07:00
Olaoluwa Osuntokun
f6d6d6609f
lnrpc/invoicesrpc: extend hop hint selection to account for MPP
In this commit, we update the hop hint selection to account for the fact
that with MPP, a single payment may consume multiple channels. As is, if
a user only has two 0.5 BTC channels, and tries to make a 1 BTC channel,
then the current logic won't include any hop hints.

To solve this, we first add all the channels which in isolation can
carry the payment in question. We then do another pass that accumulates
channels until either we reach our hop-hint limit, or the total
bandwidth that we've accumulate is greater than 2x the payment amount.
2020-08-13 14:47:25 -07:00
Olaoluwa Osuntokun
f42d7780f1
lnrpc/invoicesrpc: refactor out hop hint accumulation into a new function 2020-08-13 14:47:24 -07:00
Olaoluwa Osuntokun
ab055efa56
lnrpc/invoicesrpc: move hop hint eligibility for chan to new method 2020-08-13 14:47:23 -07:00
Olaoluwa Osuntokun
7a83731edb
lnrpc/invoicesrpc: move hop hint selection into new method 2020-08-13 14:47:22 -07:00
Conner Fromknecht
6622c4814e
multi: enforce routing.MinCLTVDelta=18 for invoices + chanupd
This commit clamps all user-chosen CLTVs in LND to be at least 18, which
is the new conservative value used in the sepc. This minimum is applied
uniformly to forwarding CLTV deltas (via channel updates) as well as
final CLTV deltas for new invoices.
2020-07-24 13:13:56 -07:00
Joost Jager
d416ed59ea
multi: add explicit hodl invoice flag to invoice
Previously it wasn't possible to store a preimage in the invoice
database and signal that a payment should not be settled right away. The
only way to hold a payment was to insert the magic UnknownPreimage value
in the invoice database. This commit introduces a distinct flag to
signal that an invoice is a hold invoice and thereby allows the preimage
to be present in the database already.

Preparation for (key send) hodl invoices for which we already know the
preimage.
2020-06-02 07:34:23 +02:00
Olaoluwa Osuntokun
ce0a61abeb
lnrpc/invoicesrpc: linter fix 2020-04-21 22:19:24 -07:00
Olaoluwa Osuntokun
1e51ec0a2d
lnrpc/invoicesrpc: clamp down on max invoice size
In this commit, we move to clamp down somewhat on the max invoice size
after the limit was removed as part of the mpp changes. In #4210, it was
reported that a value of -1, would underflow and end up as 18 million
BTC, which would trip checks w.r.t the max expressible value in mSAT.
In this commit, we clamp things down to 100k BTC, which should be more
than enough for anybody.

Fixes #4210.
2020-04-21 16:44:44 -07:00
Olaoluwa Osuntokun
363caa441a
rpc: allow wumbo invoices
In this commit, we remove the restriction surrounding the largest
invoices that we'll allow a user to create. After #3967 has landed,
users will be able to send in _aggregate_ a payment larger than the
current max HTLC size limit in the network. As a result, we can just
treat that value as the system's MTU, and allow users to request
payments it multiples of that MTU value.

A follow up to this PR at a later time will also allow wumbo _channels_.
However, that requires us to tweak the way we scale CSV values, as post
wumbo, there is no true channel size limit, only the
_local_ limit of a given node. We also need to implement a way for nodes
to signal to other nodes their accepted max channel size.
2020-04-09 19:02:08 -07:00
Conner Fromknecht
1367187454
multi: set invoice feature bits using feature manager 2019-12-10 13:09:52 -08:00
Conner Fromknecht
cd27ee7cfc
rpcserver+invoicesrpc: set payment addr on new invoices
This commit modifies Lighting.AddInvoice and InvoicesRPC.AddHoldInvoice
to include the node's supported feature bits on the invoice. For now
this only includes the optional TLV Onion Payload bit.
2019-12-05 07:59:31 -08:00
Conner Fromknecht
3b253e05f6
multi: restructure invoice Terms field
This commit restructures an invoice's ContractTerms to better encompass
the restrictions placed on settling. For instance, the final ctlv delta
and invoice expiry are moved from the main invoice body (where
additional metadata is stored). Additionally, it moves the State field
outside of the terms since it is rather metadata about the invoice
instead of any terms offered to the sender in the payment request.
2019-11-22 02:25:02 -08:00
Conner Fromknecht
4c872c438b
channeldb: complete migration 12 for TLV invoices 2019-11-22 02:24:28 -08:00
Conner Fromknecht
76a2dfd8a6
lnrpc: remove receipt field from invoice 2019-11-22 02:23:24 -08:00
Joost Jager
fcbf1bc07a
invoicesrpc+lnrpc: add msat fields to invoices 2019-11-15 08:59:35 +01:00
fiatjaf
f19b00c4c0
Fix error message for wrong size description_hash. 2019-09-11 11:09:52 -03:00
Joost Jager
4105142c96
channeldb+invoices: add invoice htlcs
This commit adds a set of htlcs to the Invoice struct and
serializes/deserializes this set to/from disk. It is a preparation for
accurate invoice accounting across restarts of lnd.

A migration is added for the invoice htlcs.

In addition to these changes, separate final cltv delta and expiry
invoice fields are created and populated. Previously it was required
to decode this from the stored payment request. The reason to create
a combined commit is to prevent multiple migrations.
2019-09-04 19:20:17 +02:00
Otto Suess
c843835a05
invoicesrpc: fix route hint off-by-one-error
right now it is possible to add 21 route hints which results in an error.
2019-07-12 08:51:30 +02:00
Joost Jager
19f79613df
channeldb: store hold invoice 2019-03-15 10:08:55 +01:00
Joost Jager
8392f6d28f
lnrpc/invoicesrpc: remove lnrpc type from add invoice 2019-03-15 10:08:52 +01:00
Joost Jager
b9cc165341
lnrpc: move add invoice logic to subserver 2019-03-15 10:08:49 +01:00