Commit Graph

11655 Commits

Author SHA1 Message Date
Johan T. Halseth
a6724c1088
breacharbiter: split waitForSpendEvent
We split the method waitForSpendEvent into two, such that we can reuse
it in case the commitment is spent by various transactions.
2021-05-12 12:32:28 +02:00
Johan T. Halseth
bca5839929
breacharbiter: extract countRevokedFunds 2021-05-12 12:32:28 +02:00
Johan T. Halseth
820e77d574
lncfg: make anchor channels by default
This commit again enables anchor channels by default.

During itests we still keep anchors opt-in, as many of the tests rely on
the behaviour of non-anchor channels.
2021-05-11 10:27:54 +02:00
Johan T. Halseth
8e1087d1cd
lwallet: only count public channels towards our reserved value
Since private channels (most likely) won't be used for routing other
than as last hop, they bear a smaller risk that we must quickly force
close them in order to resolve a HTLC up/downstream.

In the case where it actually has to be force to resolve a payment (if
it is the first/last hop on a routed payment), we can assume that the
router will have UTXOs available from the reserved value from the
incoming public channel.
2021-05-11 10:27:54 +02:00
Johan T. Halseth
a0b6a0b00b
lnwallet: cap value reserved for anchor fee bumping
We cap the maximum value we'll reserve for anchor channel fee bumping at
10 times the per-channel amount such that nodes with a high number of
channels don't have to keep around a very large amount for the unlikely
scanario that they all close at the same time.
2021-05-11 10:27:54 +02:00
carla
74373f26b9
invoices/test: add height expiry watcher tests with registry 2021-05-11 08:47:17 +02:00
carla
8066ff7047
itest/test: assert expired hold invoice updated correctly 2021-05-11 08:45:32 +02:00
carla
b7d1ed0cbb
itest/test: test hold invoice cancel before force close 2021-05-11 08:45:31 +02:00
carla
85e56dbfb7
invoices/test: add test for hodl invoices 2021-05-11 08:45:30 +02:00
carla
34de5922ed
multi: add height-based invoice expiry
This commit adds height-based invoice expiry for hodl invoices
that have active htlcs. This allows us to cancel our intentionally
held htlcs before channels are force closed. We only add this for
hodl invoices because we expect regular invoices to automatically
be resolved.

We still keep hodl invoices in the time-based expiry queue,
because we want to expire open invoices that reach their timeout
before any htlcs are added. Since htlcs are added after the
invoice is created, we add new htlcs as they arrive in the
invoice registry. In this commit, we allow adding of duplicate
entries for an invoice to be added to the expiry queue as each
htlc arrives to keep implementation simple. Our cancellation
logic can already handle the case where an entry is already
canceled, so this is ok.
2021-05-11 08:45:29 +02:00
Olaoluwa Osuntokun
d2c25124ed
cmd/lncli: add basic AMP support for CLI 2021-05-10 22:02:15 -07:00
Conner Fromknecht
ef392dcd0c
lntest: add amp invoice test 2021-05-10 22:02:15 -07:00
Conner Fromknecht
4e93c1303c
lntest: isolate alice+bob in mppTestContext 2021-05-10 22:02:15 -07:00
Conner Fromknecht
2ecd1de713
config: expose distinct accept-amp flag
This mirrors the accept-keysend flag, but also permits users to
eventually toggle off keysend separately from AMP.
2021-05-10 22:02:15 -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
Conner Fromknecht
b0949054e5
invoices: fail HTLCs that target the wrong type of invoice 2021-05-10 22:02:14 -07:00
Conner Fromknecht
dba055de2d
lntest/amp_test: assert subscribe invoice in sendtoroute_amp 2021-05-10 22:02:14 -07:00
Olaoluwa Osuntokun
ba5aaec632
Merge pull request #5266 from wpaulino/import-dry-run
walletrpc: expose dry run support for ImportAccount
2021-05-10 17:19:09 -07:00
Conner Fromknecht
8402e346f5
channeldb/invoice: fail extra HTLC sets immeidately 2021-05-10 16:55:18 -07:00
Conner Fromknecht
70efaa5fe2
invoices: use HTLCSet method with state filter 2021-05-10 16:55:17 -07:00
Conner Fromknecht
d93c3298b7
channeldb+invoice: add state filter to HTLCSet 2021-05-10 16:55:17 -07:00
Conner Fromknecht
620e426bc3
lncli: add --amp flag to invoice command 2021-05-10 16:55:17 -07:00
Conner Fromknecht
2be874f340
lnrpc: add IsAmp to Invoice 2021-05-10 16:55:17 -07:00
Conner Fromknecht
541041f4a8
invoicesrpc: add ability to generate AMP invoices 2021-05-10 16:55:17 -07:00
Conner Fromknecht
6a7d3c4b5e
lnrpc+rpcserver: thread GenAmpInvoiceFeatures to invoicesrpc 2021-05-10 16:55:17 -07:00
Conner Fromknecht
e97da53676
feature: populate SetInvoiceAmp with TlvOpt+PayAddrReq+AmpReq 2021-05-10 16:55:16 -07:00
Conner Fromknecht
bbb841bd5f
feature/set: add SetInvoiceAmp
AMP invoices need to signal:
 - AMPRequired in order to avoid being paid by older clients that don't
   support it.
 - Can't advertised MPP optional, otherwise older clients will attempt
   to pay the invoice with regular MPP payment.

Hence, the features advertised on AMP invoices are mutually exclusive
from those advertised on MPP. Create a new set to classify the two.
2021-05-10 16:55:16 -07:00
Conner Fromknecht
9020a4d2a5
lnrpc/invoicesrpc: extract paymentHashAndPreimage helper 2021-05-10 16:55:12 -07:00
Olaoluwa Osuntokun
0d3253c410
Merge pull request #5281 from guggero/router-chain-sync
itest flakes: fix multiple issues around router subsystem being out of sync
2021-05-10 13:11:37 -07:00
Oliver Gugger
6c37cae639
lntest+routing: update best height after graph pruning
It seems #5246 introduced a subtle bug that lead to the error "out of
order block: expecting height=1, got height=XXX" some times during
startup. Apparently it can happen that during pruning of the graph tip
some blocks can come in before we start our chain view and the new block
subscription. By querying the chain backend for the best height before
syncing with the graph we ensure that we never miss a block.
2021-05-10 16:46:28 +02:00
Oliver Gugger
8147b270d4
lntest: wait for chain sync in switch test 2021-05-10 16:46:28 +02:00
Oliver Gugger
ea4ef204a0
rpcserver: add router synced to synced_to_chain flag
The router has a lot of work to do for each block. So it might be
possible that it isn't yet up to date with the most recent block,
even if the wallet is. This can happen in environments with high CPU
load (such as parallel itests). Since the `synced_to_chain` flag in
the response of this call is used by many wallets (and also our
itests) to make sure everything's up to date, we add the router's
state to it. So the flag will only toggle to true once the router was
also able to catch up.
2021-05-10 16:46:28 +02:00
Oliver Gugger
9f0228b21c
router: add SyncedHeight() method
The router subsystem has its own goroutine that receives chain updates
and then does its (quite time consuming) work on each new block. To make
it possible to find out what block the router currently is synced to, we
export its internal best height through a new method.
2021-05-10 16:46:27 +02:00
Johan T. Halseth
6f2f23aae6
Merge pull request #5284 from yuki-js/master
lnrpc: Change State -> state in GetState
2021-05-10 10:41:09 +02:00
yuki-js
241f62fbb6 lnrpc: Change State -> state in GetState
protobuf and rest field's first letter should be lower case
2021-05-09 22:50:10 +00:00
Wilmer Paulino
e079a9583c
walletrpc: use bytes to represent master key fingerprint
The integer representation is not common and using bytes allows users to
easily confirm whether their master key fingerprint is correct.
2021-05-07 13:07:10 -07:00
Wilmer Paulino
f7b130b5ca
lncli: add dry run flag for wallet account import command 2021-05-07 13:07:10 -07:00
Wilmer Paulino
e180023843
walletrpc: expose dry run support for ImportAccount 2021-05-07 13:06:27 -07:00
Olaoluwa Osuntokun
1868c7dec1
Merge pull request #5231 from Crypt-iQ/unsigned_ack_patch_04212021
lnwallet: use tail not tip in getUnsignedAckedUpdates
2021-05-07 12:46:48 -07:00
Juan Pablo Civile
a10c96a63b htlcswitch: set sourceRef when resolving packets through interceptor
Having it set to nil caused https://github.com/lightningnetwork/lnd/issues/5115

The problem was several layers removed from the fix. The link decides to
clean up a `fwdPkg` only if it's completed, otherwise it renotifies the
HTLCs. A package is only set to complete if it's `addAck` and
`settleFail` filters are full. For forwarded HTLCs, the `addAck` was
never being set so it would never be considered complete under this
criteria.

`addAck` is set for an HTLC when signing the next commitment TX in the
`LightningChannel`. The path for this is:
* `LightningChannel#SettleHtlc` adds the HTLC to `localUpdates`
* `LightningChannel#SignNextCommitment` builds the `ackAddRef` for all
updates with `SourceRef != nil`.
* `LightningChannel#SignNextCommitment` then passes the list of
`ackAddRef` to `OpenChannel#AppendRemoteCommitChain` to persist the new
acks in the filter

Since `SourceRef` was nil for interceptor packages, `SignNextCommitment`
ignored it and the ack was never persisted.
2021-05-07 10:31:22 -03:00
Andras Banki-Horvath
3c6f036bee
kvdb: make lnd/kvdb a submodule 2021-05-07 14:18:57 +02:00
Andras Banki-Horvath
14c851c8fc
kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
Johan T. Halseth
b1d9525d29
Merge pull request #5269 from bhandras/healthcheck_module
kvdb: separate healthcheck module
2021-05-07 14:05:48 +02:00
Johan T. Halseth
a8d813a4e5
Merge pull request #5277 from guggero/neutrino-update
mod: bump neutrino dep to latest version
2021-05-07 13:56:55 +02:00
Johan T. Halseth
2f99cd7ba1
Merge pull request #5268 from yyforyongyu/fix-whitelist
trivial: update log_error_whitelist
2021-05-07 13:56:21 +02:00
Johan T. Halseth
683a3f952a
Merge pull request #5275 from halseth/mod-update-btcd
mod: update btcd to latest master
2021-05-07 13:55:39 +02:00
Johan T. Halseth
99c609c1a8
mod: update btcd to latest master 2021-05-07 11:36:46 +02:00
yyforyongyu
270984b7d5
trivial: update log_error_whitelist 2021-05-07 13:20:54 +08:00
Wilmer Paulino
994405709a
lnwallet: expose dry run support for ImportAccount 2021-05-06 19:04:21 -07:00