Commit Graph

9363 Commits

Author SHA1 Message Date
Joost Jager
5bebda8c5d
multimutex: add hash mutex 2020-04-08 08:54:05 +02:00
Joost Jager
f907fbcadc
queue: detect close of incoming channel 2020-04-08 08:54:03 +02:00
Joost Jager
278915e598
channeldb: return updated payment on attempt update
Similar to what is done for SettleAttempt.

Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2020-04-08 08:54:01 +02:00
Joost Jager
351d8e174c
lnrpc: expose payment failure reason 2020-04-08 08:53:59 +02:00
Joost Jager
327634e9f7
routerrpc: move payment marshalling 2020-04-08 08:53:57 +02:00
Joost Jager
5d0a117162
routing: fix log 2020-04-08 08:14:10 +02:00
Olaoluwa Osuntokun
7e6f3ece23
Merge pull request #3960 from bitromortac/listpayments-pagination
channeldb+lnrpc+lncli: listpayments pagination support
2020-04-07 17:06:37 -07:00
Conner Fromknecht
2ccec4bc5c
Merge pull request #4152 from cfromknecht/lncli-invoices-category
cmd/lncli: move invoice-related cmds to Invoices category
2020-04-07 15:48:38 -07:00
Conner Fromknecht
b8da7e54fb
Merge pull request #4145 from cfromknecht/remove-overflow-queue
htlcswitch: remove overflow queue
2020-04-07 14:33:30 -07:00
Conner Fromknecht
f50649d21b
htlcswitch/link: remove overflow queue
This commit removes the overflowQueue from the link. We do so in order
to promote better UX for senders, so that HTLCs are failed faster when
the commitment is full. This gives the sender the opportunity to try
another, more open path, rather than perceive the HTLC as being stuck.

At the same time, we remove the total number of active goroutines in lnd
by a factor of N where N is the number of active channels.
2020-04-07 13:20:36 -07:00
Conner Fromknecht
68d1753dcb
htlcswitch/test_utils: send htlcs before waiting for result
This commit is preparation for the test added in the subsequent commit.
We modify makeHoldPayment to return any failures direectly when trying
to add an HTLC to the switch. This lets us know that the HTLC was indeed
sent without failure when the method returns.
2020-04-07 11:56:22 -07:00
Conner Fromknecht
5a057de5c4
htlcswitch/mailbox: remove errors from AckPacket, Start, Stop
A following commits will move/modify callsites of AckPacket, Start, and
Stop, none of which use the return value and ultimately cause the linter
to complain. However, none of these in-memory operations can fail so we
just remove the returned errors altogether.
2020-04-07 11:55:54 -07:00
Conner Fromknecht
e86ddf6ae7
htlcswitch/link: remove unused isReProcess argument 2020-04-07 11:55:25 -07:00
Conner Fromknecht
759d7a122f
htlcswitch/test_utils: add missing return
This commit corrects a bug in the testing harness that could cause
more than one error to be returned on the error channel.
2020-04-07 11:54:56 -07:00
Conner Fromknecht
310e20f8b7
invoices/invoiceregistry: remove debug spew 2020-04-07 11:54:29 -07:00
Conner Fromknecht
77041c131a
htlcswitch/switch_test: add t.Helper() to assertion 2020-04-07 11:54:02 -07:00
Conner Fromknecht
028345daea
htlcswithc/link_test: rm unused arg from generateHtlc
Linter started complaining.
2020-04-07 11:53:36 -07:00
Conner Fromknecht
2c3641e915
htlcswitch/link_test: fix preimage assertion
This flakes locally for me on darwin.
2020-04-07 11:53:15 -07:00
Conner Fromknecht
425b2c712f
htlcswitch/switch_test: increase checkHtlcEvents timeout
This flakes locally for me on darwin.
2020-04-07 11:52:50 -07:00
bitromortac
4593cfa6c6 lncli: modify listpayments to use queried payments and update cli docs 2020-04-07 07:03:51 +02:00
bitromortac
97b759796d itest: fix comment in list_outgoing_payments test 2020-04-07 07:03:51 +02:00
bitromortac
39c58d9d14 lnrpc: use queried payments to list payments in the rpc
Changes the grpc proto file, generates the protobuf, and
enables a queried way to retrieve payments in the rpc, where
backward compatibility is enforced by returning all payments
in the database by default. Adds a payment index field to
the returned payments of the rpc call.
2020-04-07 07:03:51 +02:00
bitromortac
d5dd48fa71 channeldb/test: unit tests for payments query
Adds tests for the payments query, where different edge cases for
the index offsets and normal and reversed orders are tested.
2020-04-07 07:03:21 +02:00
bitromortac
4c5e8aec41 channeldb: add payments query
Adds a PaymentsQuery struct, which contains parameters to restrict the
response of QueryPayments, returning a PaymentsQuerySlice with the
payments query result. The behavior of this api is the same as
the QueryInvoices one.
2020-04-07 07:03:21 +02:00
bitromortac
4800a84122 channeldb: export sequenceNum in MPPayment
Exports sequenceNum in MPPayment for later use
in the rpcserver.
2020-04-07 07:03:21 +02:00
Olaoluwa Osuntokun
e52c5df8ab
Merge pull request #4140 from carlaKC/lnrpc-pendingchannelinitiator
lnrpc: use initiator enum for pending channel open initiator
2020-04-06 15:46:46 -07:00
Conner Fromknecht
3233388750
cmd/lncli: move invoice-related cmds to Invoices category
The Payments category is getting quite large, so this commit breaks out
the invoice-related commands into their own category.
2020-04-06 14:24:08 -07:00
Conner Fromknecht
4aceaba1be
cmd/lncli: move invoice commands to cmd_invoice.go 2020-04-06 14:23:21 -07:00
Olaoluwa Osuntokun
173f7d88e0
Merge pull request #4121 from cfromknecht/sort-htlc-sigs
lnwallet: apply BIP69+CLTV tie-break to HTLC signature order
2020-04-03 18:12:58 -07:00
Olaoluwa Osuntokun
a8a0aaa214
Merge pull request #4143 from cfromknecht/open-channel-flakes
lntest/itest/lnd_test: wait when calling OpenChannel
2020-04-03 18:10:45 -07:00
Olaoluwa Osuntokun
c88b910a35
Merge pull request #4151 from cfromknecht/cnct-log-fixes
contractcourt/chain_watchter: fix broken log stmts
2020-04-03 18:08:32 -07:00
Olaoluwa Osuntokun
2e0f7c4ac2
Merge pull request #4091 from wpaulino/wallet-scan-relevant-key-scopes
build: update btcwallet dependency to only scan relevant key scopes
2020-04-03 18:07:59 -07:00
Conner Fromknecht
978ff82f1f
contractcourt/chain_watchter: fix broken log stmts 2020-04-03 15:29:18 -07:00
Wilmer Paulino
f6ff3131d8
lntest/itest: add change address recovery case to onchain recovery test
This is mainly motivated by a now fixed bug in the wallet in which
change addresses could at times be created outside of the default key
scopes. Recovery only used to be performed on the default key scopes, so
ideally this test case would've caught the bug earlier.
2020-04-03 15:26:19 -07:00
Wilmer Paulino
1a1e8b6dad
build: update btcwallet dependency to scan/recover all key scopes 2020-04-03 15:26:18 -07:00
Olaoluwa Osuntokun
92ee49767f
Merge pull request #3970 from halseth/amp-router-mvp-2020
MPP: Enable MultiPathPayments for payment lifecycle
2020-04-03 13:53:19 -07:00
Wilmer Paulino
d04bc200e7
Merge pull request #4144 from cfromknecht/frozen-chan-fixups
multi: frozen chan fixups
2020-04-03 11:21:22 -07:00
carla
d66ff04583
lnrpc: use initiator enum for pending channel channel intiator
Update the PendingChannel message from a bool to an enum to
differentiate between the case where the remote party initiated the
channel and we have no record of the channel initiator. The previous
field has not been included in a release of lnd, so we can replace the
field directly.
2020-04-03 11:26:21 +02:00
carla
2ae61162db
lnrpc: move initiator enum out of close summary
Move enum out of CloseSummary struct for more general use. This does
not change the encoding of the enum, and will only cause compile time
errors for existing clients. This enum has not been included in a
release yet, so we can make this move without much disruption.
2020-04-03 11:26:11 +02:00
carla
0512b39f23
lnrpc: format protobuf file 2020-04-03 09:09:23 +02:00
Conner Fromknecht
3f4dc0decd
lnwallet/channel: increase htlc validation strictness
This commit adds an additional santity check that rejects zero-value
HTLCs, preventing them from being added to the channel state even if the
channel config's minhtlc value is zero.
2020-04-02 18:03:06 -07:00
Conner Fromknecht
ae41623a91
lntest/itest/lnd_test: wait when calling OpenChannel
In #4130, OpenChannel was changed to assert that the wallet is fully
synced before allowing a channel open. This introduced flakes on travis,
which are resolved here by using a wait predicate when calling
OpenChannel.

Note there is one existing call that was not converted, because it is
interested in the returned error. This call does not have a wait
predicate surrounding it, but this shouldn't cause a flake because other
channels are opened earlier in the test that will have already waited
for the wallet to sync up.
2020-04-02 17:56:00 -07:00
Conner Fromknecht
184939c81a
Merge pull request #4138 from Roasbeef/cnct-logging
contractcourt: add additional logging of commitments at play
2020-04-02 17:54:30 -07:00
Conner Fromknecht
b0c3072ff7
lnwallet/channel_test: assert commit sorting of commit diff htlcs
This commit adds a test to exercise that HTLC signatures are sent in the
correct order, i.e. they match the sorting of the HTLC outputs on the
commitment after applying BOLT 3's BIP69+CLTV sort.
2020-04-02 17:51:02 -07:00
Conner Fromknecht
3ea3b1d0b5
lnwallet/channel: tie-break HTLCs by cltv when locating
This commit fixes #4118 by properly sorting the HTLC signatures sent
over the wire to match the BOLT3 BIP69+CLTV sorting of the commitment
outputs.

To do so, we expose the slice of cltv deltas for HTLCs on the unsigned
commitment after applying the commitment sorting. This will be used to
locate the proper output index, as the CLTV serves as a tie breaker
between HTLCs that otherwise have the same payment hash and amount.

Note that #3412 fixed the issue partially by ensuring the commitment was
constructed properly (and the second-level prev outpoint's txid was
correct), but failed to address that the HTLC signatures were still sent
out in the incorrect order. With this, we pass the test case introduce
in the next commit.
2020-04-02 17:51:02 -07:00
Conner Fromknecht
294e13eefc
lnwallet/commitment: split our/theirBalance comment 2020-04-02 17:51:02 -07:00
Conner Fromknecht
97761833d2
lnwallet/channel: populate htlc indexes from disk commit
We currently write each HTLCs OutputIndex to disk, but we don't use it
when restoring. The restoration is modified to use these directly, since
we will have lost access to the sorting of CLTVs after the initial
signing process.
2020-04-02 17:50:59 -07:00
Conner Fromknecht
d1fa33c8eb
rpcserver: only block co-op close for frozen chans
This commit fixes a recent issue from #4081 that would prevent a frozen
channel from being force closed via the rpc. We correct this, so that
only the co-op path is inhibited.
2020-04-02 17:40:08 -07:00
Conner Fromknecht
3c371dd633
rpcserver: remove NewLightningChannel usage in CloseChannel 2020-04-02 17:39:47 -07:00
Conner Fromknecht
ec784db511
multi: remove returned error from WipeChannel
The linter complains about not checking the return value from
WipeChannel in certain places. Instead of checking we simply remove the
returned error because the in-memory modifications cannot fail.
2020-04-02 17:39:29 -07:00