Commit Graph

11611 Commits

Author SHA1 Message Date
Johan T. Halseth
783d1f9578
breacharbiter: remove justiceTx finalization
Now that we don't rely on the justice tx TXID anymore, we can remove
finalization of it. Instead we'll recreate the transaction when needed
from the persisted retribution info.
2021-05-12 12:32:29 +02:00
Johan T. Halseth
3be9b74694
breacharbiter: replace justice tx conf check with spend check
Since we want to potentially broadcast multiple versions of the justice
TX, instead of waiting for confirmation of a specific TXID, we instead
wait for the breached outputs to be spent.
2021-05-12 12:32:29 +02:00
Johan T. Halseth
c3b2791158
breacharbiter: don't transition to second level if own spend 2021-05-12 12:32:29 +02:00
Johan T. Halseth
0a0b5f89c9
input: create IsHtlcSpendRevoke 2021-05-12 12:32:29 +02:00
Johan T. Halseth
e7ee5ad51f
breacharbiter_test: extract sweep tx creation into method 2021-05-12 12:32:29 +02:00
Johan T. Halseth
a192718807
breacharbiter_test: distinguish spending transactions from justice tx
inputs

Since we want to test more complex combinations of spends of the
breached outputs, we use two maps tracking

1. which transaction will spend the outpoint
2. which outpoints we expect the breacharbiter to include in the justice
   tx

This let us trigger spends of the individual outputs, and depending on
what we want to test check whether the breacharbiter sweeps the expected
outpoints.
2021-05-12 12:32:28 +02:00
Johan T. Halseth
3aa5e650fb
lntest/mock: set input index on spend event 2021-05-12 12:32:28 +02:00
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
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