Commit Graph

11501 Commits

Author SHA1 Message Date
Johan T. Halseth
fb99994720
breacharbiter_test: assert publication of adjusted justice tx
Since the breacharbiter will publish an adjusted justice tx after
detecing a spend from the breached commitment, we could get into a race
where sometime it would not get the second spend before publication,
resulting in a deadlock on the publTx channel.

Now we instead wait for the publication of this adjusted tx before
notifying the second spend.
2021-05-21 09:53:20 +02:00
Johan T. Halseth
b74c1ca822
breach tests: increase cleanup timeout
1 second was not always enough for the breacharbiter to cleanup,
  especially in case of the more complex split sweep.
2021-05-20 09:50:14 +02:00
Johan T. Halseth
07c0277f3b
breacharbiter_test: select on quit chan on publication
Since publication would deadlock on publishing the tx in case the test
had failed we also select on the brar quit channel.
2021-05-20 09:12:32 +02:00
Olaoluwa Osuntokun
dee6a1a29b
Merge pull request #5314 from Roasbeef/13-rc3
build: bump version to v0.13.0-beta.rc3
2021-05-19 21:02:23 -07:00
Olaoluwa Osuntokun
7716175454
build: bump version to v0.13.0-beta.rc3 2021-05-19 18:26:22 -07:00
Olaoluwa Osuntokun
f5ee874a0b
Merge pull request #5305 from carlaKC/sessionkey-deserialize
channeldb: read HtlcAttemptInfo session key raw bytes
2021-05-19 17:14:17 -07:00
Olaoluwa Osuntokun
c18f3333d8
Merge pull request #5247 from joostjager/deprecate-chan-capacity
lnrpc: deprecate route hop channel capacity field
2021-05-19 17:06:15 -07:00
Olaoluwa Osuntokun
47403c0be4
Merge pull request #5226 from yyforyongyu/small-fix-invoice
invoices: remove unused param in notifyClients
2021-05-19 16:36:06 -07:00
Olaoluwa Osuntokun
7f10e2bb75
Merge pull request #5309 from guggero/fix-router-annotations
lnrpc: fix typos in REST annotations for routerrpc
2021-05-19 11:24:49 -07:00
Oliver Gugger
3eb7539de1
lnrpc: fix typos in REST annotations for routerrpc
Fixes #5307.
Corrects some typos in the REST annotations for the routerrpc subserver.
Unfortunately these mistakes aren't caught by the current version of the
grpc-gateway library. But we intend to update to v2 soon which will
output alerts as mentioned in #5307.
2021-05-19 09:48:33 +02:00
carla
64333c0303
channeldb: cache htlc attempt session key 2021-05-19 09:08:18 +02:00
carla
8071ebb16a
channeldb: read raw htlc attempt session key 2021-05-19 09:03:52 +02:00
carla
eb068bf666
multi: unexport session key and add constructor for htlc attempt info 2021-05-19 09:03:46 +02:00
Olaoluwa Osuntokun
6c330d3121
Merge pull request #5303 from guggero/policy-nil-check
rpcserver: add nil check to policy ordering
2021-05-18 15:47:27 -07:00
Oliver Gugger
3a5a03fa49
rpcserver: add nil check to policy ordering
Fixes #5301.
This was introduced with #5295. Since either policies can be nil, we
need to always check that first.
2021-05-18 21:17:09 +02:00
Joost Jager
2749b805b0
lnrpc: deprecate route hop channel capacity field 2021-05-16 11:58:23 +02:00
Conner Fromknecht
cfa7188b1d
Merge pull request #5298 from cfromknecht/bump-version-v0.13.0-beta.rc2
build/version: bump to v0.13.0-beta.rc2
2021-05-14 12:20:39 -07:00
Conner Fromknecht
5305854c2b
Merge pull request #5295 from wpaulino/getnodeinfo-policy-order
rpc: fix policy order for GetNodeInfo
2021-05-14 12:16:47 -07:00
Conner Fromknecht
196aea665e
build/version: bump to v0.13.0-beta.rc2 2021-05-14 11:03:30 -07:00
Oliver Gugger
e39d00900c
Merge pull request #5260 from guggero/windows-itest
Travis: fix Windows itest
2021-05-14 12:57:51 +02:00
Oliver Gugger
e4873ac878
lntest: re-use P2P ports during SCB recovery
In some rare instances it can happen that the nodes don't find each
other again after one of them has been re-created and the other one has
been restarted in the SCB tests. By making sure the re-created has the
same P2P port again as before, we make sure they can connect to each
other again successfully for executing DLP.
2021-05-14 10:59:10 +02:00
Oliver Gugger
702dda6448
itest: reconnect nodes more quickly on SCB restore
Since there is a lot of connecting and disconnecting between nodes in
the channel backup tests, we try to speed up that process by lowering
the min backoff from 1 second to 50 milliseconds. We also make sure we
never wait more than 1 second if it does take multple attempts. This
should sum up and hopefully speed up our tests a bit.
2021-05-14 10:09:04 +02:00
Oliver Gugger
57f3a2c595
Travis: decrease Windows itest parallelism
The Windows virtual machine that Travis runs the integration tests on
seems to be slower than the other machines. We try to increase the
stability of the tests by cutting the number of parallel running suites
in half. This will come at the cost of longer execution time but
hopefully with a better stability in return.
2021-05-14 10:09:02 +02:00
Olaoluwa Osuntokun
a2138f0038
build: bump version to v0.13.0-beta.rc1 2021-05-13 18:26:50 -07:00
Olaoluwa Osuntokun
ea026257ee
Merge pull request #5296 from Roasbeef/dep-update-2021-may
build: update neutrino+btcwallet modules to latest versions
2021-05-13 18:11:04 -07:00
Olaoluwa Osuntokun
fb632ab4ee
build: update neutrino+btcwallet modules to latest versions 2021-05-13 17:18:20 -07:00
Olaoluwa Osuntokun
7ab5906093
Merge pull request #5245 from bhandras/kvdb_module
kvdb: make kvdb a top level submodule to allow dependency in other projects
2021-05-13 15:59:20 -07:00
Olaoluwa Osuntokun
3cc9e63bb5
Merge pull request #5293 from Crypt-iQ/prevent_zombie_payments_05122021
multi: validate payment params at RPC layer
2021-05-13 15:48:09 -07:00
Olaoluwa Osuntokun
875a3d9659
Merge pull request #5291 from guggero/psbt-segwit-check
chanfunding: extend PSBT witness input check
2021-05-13 15:46:20 -07:00
eugene
a70d0bef34
multi: validate payment params at RPC layer
With this patch, we'll fail out earlier in the cycle in case of
some wonky parameters, and not leave zombie payments in the router
which currently are not cleaned up.
2021-05-13 17:17:52 -04:00
Oliver Gugger
2d70b46269
chanfunding: extend PSBT witness input check
Fixes #5287.

The PSBT spec is a bit vague when it comes to the WitnessUtxo field of
an input as it's not strictly required for witness inputs. Therefore
Electrum for example does not include the field.
We need to make the SegWit input check a bit more elaborate by looking
at the output script of the UTXO and also the redeem script in case it's
a nested SegWit spend.
2021-05-13 20:42:57 +02:00
Andras Banki-Horvath
fc139d9bb8
kvdb: add ForEachBucket implementation 2021-05-13 10:35:35 +02:00
Wilmer Paulino
b01437d24e
rpc: fix policy order for GetNodeInfo
GetNodeInfo retrieves the policies for every edge the node belongs to.
When these policies are retrieved from the database, they're returned
in the following order: the first policy is the outgoing policy from the
node, and the second is the incoming policy to the node. This ordering
is not consistent with the ordering we have within our other RPCs like
GetChanInfo and DescribeGraph, where policies are sorted based on the
smaller public key of the nodes within an edge.

We fix this by maintaining the same order as our other RPCs.
2021-05-12 18:24:38 -07:00
Olaoluwa Osuntokun
6a2fb316ca
Merge pull request #5274 from halseth/anchors-reserved-value-max
[anchors] cap value reserved for anchor fee bumping
2021-05-12 16:19:57 -07:00
Olaoluwa Osuntokun
c0acdd8082
Merge pull request #5036 from halseth/breacharbiter-justice-splitting
[breacharbiter] Split justice tx in case of delayed confirmation.
2021-05-12 13:42:42 -07:00
Olaoluwa Osuntokun
86c5e483b2
Merge pull request #5206 from carlaKC/4987-heightexpirywatcher
invoices: add height based expiry watcher
2021-05-12 13:41:52 -07:00
Olaoluwa Osuntokun
93730088c5
Merge pull request #5256 from guggero/wallet-unlock-file
Auto-unlock wallet from password file
2021-05-12 13:41:30 -07:00
Olaoluwa Osuntokun
dc73a23e81
Merge pull request #5253 from cfromknecht/amp-invoice
Support paying AMP invoices via SendPaymentV2
2021-05-12 13:38:42 -07:00
Johan T. Halseth
02268b8912
breacharbiter: fix revoked funds calculation
Since we also must count revoked funds swept from second level revoked
outputs, we move the funds counting into the updateBreachInfo method,
where we already are checking whether the spend is by us or the remote.

We also clean up the logs a bit, to log the incremental sweep of funds
that now can happen.
2021-05-12 12:32:29 +02:00
Johan T. Halseth
db0ec12412
breacharbiter: broadcast "splitted" justice tx if spend all not
confirming

In case 4 block passes without our justice tx confirming, we'll "split"
it up, and separately sweep the commitment outs, and HTLC outs.
2021-05-12 12:32:29 +02:00
Johan T. Halseth
2d710154c4
breacharbiter: create split variants of justice tx
We define a new struct justiceTxVariants, which holds three different
justice transactions:

1. The "normal" justice tx that spends all breached outputs
2. A tx that spends only the breached to_local output and to_remote output
   (can be nil if none of these exist)
3. A tx that spends all the breached HTLC outputs (can be nil if no HTLC
   outputs exist)

This will later be used to sweep the time sensitive outputs separately,
in case the normal justice tx doesn't confirm in time.
2021-05-12 12:32:29 +02:00
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