Commit Graph

12373 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
d8ce00e016
lnrpc/invoicesrpc: expose new lookup modifier to LookupInvoiceV2 2021-10-28 15:50:17 -07:00
Olaoluwa Osuntokun
a4f8842831
channeldb: optimize updateInvoice for AMP by only reading relevant HTLCs
In this commit, we update the logic in `updateInvoice` to allow callers
to pass in either a hint, or the setID in the update callback. This
makes things more efficient for AMP invoices with thousands of recurring
payments, as we no longer need to read out _all_ the invoices each time
we go to update the state of a few HTLCs.
2021-10-28 15:50:15 -07:00
Olaoluwa Osuntokun
f969d81e1a
channeldb: for AMP, store set ID w/ invoice num in settle index
This change allows us to deliver notifications to a user of all the
settled recurring payments to the same payment_addr in the order that
they occurred.
2021-10-28 15:50:12 -07:00
Olaoluwa Osuntokun
3b28ad6d72
channeldb: for AMP don't update the main invoice state in updateInvoice
In this commit, we modify the way we handle state updates for AMP
invoices. With the current logic, once an invoice is settled, we'll
update the primary invoice state. This means that a user can't take the
same payment_addr, w/ a new set_id and pay the invoice again.

To remedy this, we'll move to instead _not_ updating the main invoice
state each time a new htlc Set (group of HTLCs according to setID) is
added. Instead, given that each HTLC stores an individual state, we'll
instead just use that directly from now on.

We also update TestSetIDIndex to account for new repeated settle AMP
logic.
2021-10-28 15:50:10 -07:00
Olaoluwa Osuntokun
c0f934e363
channeldb: don't cancel other HTLCs w/ diff setID once once is settled
With this change, we allow multiple users to concurrently pay the same
AMP invoice with distinct set IDs.
2021-10-28 15:50:07 -07:00
Olaoluwa Osuntokun
700bae16a3
channeldb: store AMP invoice htlc sets in new prefix key near invoice
In this commit, we modify the HTLC storage for AMP invoice only to be
stored within a new key prefix next to the main invoice data. We do this
as otherwise each time an AMP invoice is settled (enabled by the
following commits), we need to continually encode+decode the _entire_
set of invoices.

Instead, we store the AMP invoices within the main invoice bucket, using
the invoice number as a key prefix, with the final key being:
`invoiceNum || setID`
2021-10-28 15:50:04 -07:00
Olaoluwa Osuntokun
65cca8dd1c
channeldb: add new AMPInvoiceState field to store AMP sub-invoice metadata
In this commit, we add a new type `AMPInvoiceState` that's used to store
AMP sub-invoice meta data alongside the main invoice. This will be used
to allow changes to be made to an AMP invoices without reading out all
the HTLCs. In addition, callers can use this metadata to look up
information about the current sub-invoice state of AMP HTLCs.
2021-10-28 15:50:02 -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
Olaoluwa Osuntokun
b45c4ea7e3
Merge pull request #5828 from Crypt-iQ/switch_dust_flake_10052021
htlcswitch: remove 5 second timeout for data race unit tests
2021-10-27 17:13:09 -07:00
Oliver Gugger
5681c0eecf
Merge pull request #5897 from lightningnetwork/config-parser-fix
Bug fixes for lightning-terminal
2021-10-26 19:49:15 +02:00
Oliver Gugger
af09f11c1c
rpcperms: don't intercept if no middleware is registered
If there is no middleware registered, we don't need to intercept any
call and therefore can skip the request and macaroon parsing section.
2021-10-26 17:48:10 +02:00
Oliver Gugger
c02bf19fc5
config: fix reflection parsing in LiT
In the case where lnd's config struct is embedded inside another struct
(for example in lightning-terminal), the flag won't be found under its
original name. So we try to also look it up under the prefixed name.
2021-10-26 17:46:21 +02:00
eugene
2fbc35ca26
docs: update release notes for 0.14.0 2021-10-26 10:32:19 -04:00
eugene
ee2162b5d2
htlcswitch: remove 5 second timeout for data race unit tests 2021-10-26 10:32:13 -04:00
Oliver Gugger
6450f0c080
Merge pull request #5895 from LN-Zap/upstream/fix/sweeps-missing-label
sweep: add label to sweep transactions
2021-10-26 15:25:55 +02:00
Bjarne Magnussen
d342457ab2
release notes 0.14.0 2021-10-26 13:14:04 +02:00
Bjarne Magnussen
0fc17238cd
sweep: add label to sweep transactions 2021-10-26 12:52:22 +02:00
Olaoluwa Osuntokun
0a3bc3ee3d
Merge pull request #5840 from guggero/bolt-pathfinding-fallback
db: allow turning off in-memory graph cache for bbolt
2021-10-25 14:24:10 -07:00
Olaoluwa Osuntokun
11b157705c
Merge pull request #5598 from champo/relax_channel_disabled
routing: relax penalties for channel disabled errors
2021-10-25 14:21:36 -07:00
Olaoluwa Osuntokun
60a1f2d8d9
Merge pull request #5874 from Roasbeef/chan-type-feature-bit-fix
lnwire: switch chan_type feature to bits 44/45
2021-10-25 14:19:29 -07:00
Oliver Gugger
8095901924
Merge pull request #5893 from guggero/waddrmgr-update
mod: update btcwallet dependency to fix crash
2021-10-25 15:13:55 +02:00
Oliver Gugger
f045ee5e96
Merge pull request #5881 from alexbosworth/patch-6
lnrpc: log channel point in coop close warning
2021-10-25 11:30:08 +02:00
Oliver Gugger
ad9c160bc9
Merge pull request #5845 from guggero/itest-fixes-rest
itest: fix build matrix, WebSocket test timeout and log file upload
2021-10-25 11:16:20 +02:00
Oliver Gugger
bdf787b248
Merge pull request #5879 from lightningnetwork/go-get-deprecated
lnrpc: migrate `go get` to `go install`
2021-10-25 09:52:42 +02:00
Oliver Gugger
47879d95e8
mod: update btcwallet dependency to fix crash
Fixes #5864.
Updates the btcwallet dependency to the version that fixes the
concurrent map access crash.
2021-10-25 09:50:58 +02:00
Juan Pablo Civile
04c0718401 routing: report success up to the failing node on FailChannelDisabled 2021-10-24 16:53:50 -03:00
Alex Bosworth
262992fbe3
include release note 2021-10-22 13:57:10 -07:00
Alex Bosworth
6a1283cf0b
lnrpc: log channel point in coop close warning
Use `Warnf` to include the chanpoint in the warning message instead of printing `%v` to the log
2021-10-22 13:20:55 -07:00
positiveblue
416a96e2c1
lnrpc: migrate deprecated go get to go install
Starting in Go 1.17, installing executables with go get is deprecated.
Migrate our docker file for lnrpc protos.
2021-10-22 09:25:22 -07:00
Oliver Gugger
27632daa98
itest: test path finding without cache 2021-10-22 09:32:50 +02:00
Oliver Gugger
01015aced4
routing: run path finding tests against cache and DB
To make sure we don't hit any edge cases we refactor the path finding
tests to run both with and without the cache enabled.
2021-10-22 09:32:49 +02:00
Oliver Gugger
0a2ccfc52b
multi: use single read transaction for path finding
This commit partially reverts bf27d05a.
To avoid creating multiple database transactions during a single path
finding operation, we create an explicit transaction when the cached
graph is instantiated.
We cache the source node to avoid needing to look that up for every path
finding session.
The database transaction will be nil in case of the in-memory graph.
2021-10-22 09:32:49 +02:00
Oliver Gugger
1fef2970cf
channeldb: implement DB fallback for path finding
If the in-memory graph cache is disabled, we fall back to querying the
database.
2021-10-22 09:32:48 +02:00
Oliver Gugger
f216da32f3
lnd+channeldb: add graph cache option to channeldb
With this commit we forward the config option for disabling the channel
graph cache as a boolean to the channeldb. But we invert its meaning to
make the flag easier to understand.
2021-10-22 09:32:48 +02:00
Oliver Gugger
a2ad533136
docs+lncfg+sample-lnd.conf: add no-graph-cache option 2021-10-22 09:32:47 +02:00
Oliver Gugger
4e224fe0aa
GitHub: fix matrix, package log files before upload
It turns out we were using the wrong matrix variable in the actual
make command and ran the same itest 6 times with no arguments, all
resulting in running the btcd test.

To avoid uploading too many files in individual requests, we zip them
first before uploading the zip itself.
2021-10-21 12:07:15 +02:00
Oliver Gugger
423de4d79a
itest: defer close of done channel
The testing framework uses runtime.Goexit() when a test fails which
still allows the defer calls to execute. That's why we should use defer
to close the done channel to allow all goroutines to exit properly.
2021-10-21 11:09:52 +02:00
Olaoluwa Osuntokun
cac8da819f build: update go.mod with latest healthcheck version
We need a tag after the update to the sub-module, as otherwise projects
that depend on lnd (like `lndclient`) are broken.
2021-10-20 18:53:25 -07:00
Olaoluwa Osuntokun
7f656a2550
Merge pull request #5709 from Roasbeef/lease-script-enforce
Introduce new commitment format to enforce channel lease expirations in scripts
2021-10-20 18:28:40 -07:00
Wilmer Paulino
08d93fd15b
docs: add script enforced channel leases text to release notes 2021-10-19 18:30:58 -07:00
Wilmer Paulino
e891dd0fd3
itest: test backup restore of script enforced lease channel type 2021-10-19 18:30:53 -07:00
Wilmer Paulino
0b0dd65c93
chanbackup: support backup restore of script enforced leased channels 2021-10-19 18:30:50 -07:00
Wilmer Paulino
974fc346cf
itest: update itests to use new script-enforced lease commitment type
We update several of our integration tests that exercise different
scenarios with regards to the broadcast of a channel commitment
transaction with HTLCs in-flight to use the new commitment type for
channel leases. We do this to ensure we have complete coverage of said
channel commitment type. This required changing several assumptions
throughout the tests based on when we should expect sweeps to happen.
2021-10-19 18:30:48 -07:00
Wilmer Paulino
e15ad026d4
chanacceptor: include commitment type in channel acceptor requests 2021-10-19 18:30:45 -07:00
Wilmer Paulino
c9f6d788e2
lnrpc: add new CommitmentType for script enforced leased channels 2021-10-19 18:30:43 -07:00
Wilmer Paulino
e1c269c7ed
sweep: remove previous exclusive group upon re-offered inputs
This aims to cover an edge case and also serves as an optimization of
what happens when an input that was offered to the Sweeper with an
exclusive group is re-offered without one. This happens every time we
attempt to sweep the different possible anchors of a channel at the time
of broadcast, as we don't know which commitment transaction will end up
confirming in the chain. Once the commitment transaction confirms
however, we know which anchor output to act upon and re-offer it to the
Sweeper without an exclusive group. At this point, the Sweeper will
continue to attempt sweeping the other anchor output versions even know
we know they are not valid.
2021-10-19 18:30:40 -07:00
Wilmer Paulino
5faf3dc03b
contractcourt: handle sweeping script-enforced leased channel outputs
In order to sweep the commitment and HTLC outputs belonging to a
script-enforced leased channel, each resolver must know whether the
additional CLTV clause on the channel initiator applies to them. To do
so, we retrieve the historical channel state stored within the database
and supplement it to the resolvers to provide them with what's needed in
order to sweep the necessary outputs and resolve their respective
contracts.
2021-10-19 18:30:37 -07:00
Wilmer Paulino
2f27fa370b
input: add new constructor to support CSV and CLTV locked inputs 2021-10-19 18:30:35 -07:00
Wilmer Paulino
8cfb53f64a
lnwallet: support transactions and scripts for new commitment type
This commit modifies the channel state machine to be able to derive the
proper commitment and second-level HTLC output scripts required by the
new script-enforced leased channel commitment type.
2021-10-19 18:30:32 -07:00
Wilmer Paulino
01e9bb2bff
lnwallet: coalesce different supported output scripts into single method 2021-10-19 18:30:30 -07:00