Commit Graph

5607 Commits

Author SHA1 Message Date
Conner Fromknecht
9c5c1d0cb5
htlcswitch/switch: prevent panic for unknown error decryptor 2018-08-22 10:26:27 -07:00
Conner Fromknecht
80814cf11d
lnd_test: satisfy linter alignment 2018-08-22 10:26:27 -07:00
Conner Fromknecht
b59fea460a
htlcswitch/switch: make local response handling async
This commit moves the logic handling responses to
locally-initiated payments to be asynchronous. The
reordering of operations into handleLocalDispatch
brings a serious performance burden to the switch's
main event loop. However, the at-most once semantics
of circuit map and idempotency of cleanup methods
allows concurrent operations to run in parallel.

Prior to this commit, the async_payments_benchmark
would timeout due to the forcibly serial nature of
the prior design. With this change, there is no
perceptible difference in the benchmark OMM, even
though we've added two extra db calls.
2018-08-22 10:26:26 -07:00
Olaoluwa Osuntokun
9f4685228e
Merge pull request #1763 from valentinewallace/listinvoices-pagination
channeldb+rpc: add pagination of listinvoices
2018-08-21 20:14:18 -07:00
Conner Fromknecht
5dc2a4a4b8
htlcswitch/control_tower: use one db txn for transitions
Composes the new payment status helper methods such that
we only require one db txn per state transition. This
also allows us to remove the exclusive lock from the
control tower, and enable more concurrent requests.
2018-08-21 19:23:25 -07:00
Conner Fromknecht
86b347c996
channeldb/payments: make payment status helper methods
This commit splits FetchPaymentStatus and
UpdatePaymentStatus, such that they each invoke
helper methods that can be composed into different
db txns. This enables us to improve performance on
send/receive, as we can remove the exclusive lock
from the control tower, and allow concurrent calls
to utilize Batch more effectively.
2018-08-21 19:23:25 -07:00
Conner Fromknecht
0865ac7cf6
channeldb/migrations_test: assert locally-sourced circuits...
in the circuit map are marked StatusInFlight. We also
check that hashes contained in forwarded circuits are
not updated.
2018-08-21 19:23:25 -07:00
Conner Fromknecht
11bb5685f9
channeldb/migrations: mark locally-sourced payments as InFlight...
by reading the payment hash from the circuit map.
2018-08-21 19:23:25 -07:00
Conner Fromknecht
2dd8f07014
htlcswitch/switch: use non-strict PaymentControl 2018-08-21 19:23:25 -07:00
Conner Fromknecht
2027444a56
htlcswitch/control_tower_test: test strict and non-strict ctrltwrs 2018-08-21 19:23:25 -07:00
Conner Fromknecht
98d2ffbfd0
htlcswitch/control_tower: add strict mode toggling 2018-08-21 19:23:24 -07:00
Conner Fromknecht
971ae3c744
htlcswitch/control_tower_test: move from switch_control_test 2018-08-21 19:23:24 -07:00
Conner Fromknecht
8b2237fc1d
htlcswitch/control_tower: move from switch_control 2018-08-21 19:23:24 -07:00
Conner Fromknecht
3f0dfd4e4b
htlcswitch/switch_control_test: extend tests + godocs 2018-08-21 19:23:24 -07:00
Conner Fromknecht
875128539c
htlcswitch/switch_control: expand godocs and add ErrUnknownPaymentStatus 2018-08-21 19:23:24 -07:00
Conner Fromknecht
9b52c510e9
htlcswitch/mock: remove new line to satisfy linter 2018-08-21 19:23:24 -07:00
Conner Fromknecht
d6083e0d66
htlcswitch/switch: reorder persistent calls and app ntfn...
for Settle/Fail responses.
2018-08-21 19:23:24 -07:00
Conner Fromknecht
e7c0f4c5dc
channeldb/payments: touch up docs 2018-08-21 19:23:23 -07:00
Conner Fromknecht
3a579f3305
channeldb/migrations_test: touch up docs 2018-08-21 19:23:23 -07:00
Conner Fromknecht
93e5f9a545
channeldb/migrations: touch up documentation 2018-08-21 19:23:23 -07:00
Conner Fromknecht
9f46727507
channeldb/meta_test: restore migration helper + godocs 2018-08-21 19:23:23 -07:00
Conner Fromknecht
090e97cd3b
channeldb/db_test: move migration helper back to meta_test 2018-08-21 19:23:23 -07:00
Conner Fromknecht
79a4203346
channeldb/db: add comment describing migration 2018-08-21 19:23:23 -07:00
Vadym Popov
76dbe670cb
lnd: add integration test checks unavailability to pay same preimage 2018-08-21 19:23:22 -07:00
Vadym Popov
033fd3c83d
htlcswitch: add test for integrated control tower 2018-08-21 19:23:22 -07:00
Vadym Popov
21fc7aa829
htlcswitch: integration of control tower to htlc switch 2018-08-21 19:23:22 -07:00
Vadym Popov
350287779b
htlcswitch: control tower test of payment statuses transitions 2018-08-21 19:23:22 -07:00
Vadym Popov
a3d32be808
htlcswitch: control tower implementation 2018-08-21 19:23:22 -07:00
Vadym Popov
41e31e0909
channeldb: applying payment statuses migration to current database 2018-08-21 19:23:22 -07:00
Vadym Popov
24e3310f13
channeldb: payment statuses migration test 2018-08-21 19:23:21 -07:00
Vadym Popov
f405376b8b
channeldb: add migration for payment statuses for completed payments 2018-08-21 19:23:21 -07:00
Vadym Popov
7f6fbd4533
channeldb: test of payment statuses transitions 2018-08-21 19:23:21 -07:00
Vadym Popov
7296cfb425
channeldb: add payment statuses: ground, in flight, completed 2018-08-21 19:23:18 -07:00
Conner Fromknecht
211a0299e9
htlcswitch/link: only resovle+gc fwdpkgs for live channels 2018-08-21 19:10:16 -07:00
Olaoluwa Osuntokun
f028eaa152
Merge pull request #1698 from cfromknecht/switch-fwdpkg-cleanup
[htlcswitch] fwdpkg cleanup
2018-08-21 18:56:15 -07:00
Wilmer Paulino
2906629ae5
rpcserver: implement pagination support for listing invoices
Co-authored-by: Andrey Savitskiy <taketa@users.noreply.github.com>
Co-authored-by: Valentine Wallace <valentine.m.wallace@gmail.com>
2018-08-21 18:00:08 -07:00
Wilmer Paulino
f315b5b0d1
channeldb: support querying for invoices within a specific time range
In this commit, we introduce support for querying the database for invoices
that occurred within a specific add index range. The query format includes an
index to start with and a limit on the number of returned results.

Co-authored-by: Valentine Wallace <valentine.m.wallace@gmail.com>
2018-08-21 18:00:08 -07:00
Wilmer Paulino
03399648d5
cmd/lncli: add pagination flags for listinvoices command
Co-authored-by: Andrey Savitskiy <taketa@users.noreply.github.com>
Co-authored-by: Valentine Wallace <valentine.m.wallace@gmail.com>
2018-08-21 18:00:08 -07:00
Wilmer Paulino
1c7f10a467
lnrpc: add pagination fields for ListInvoices RPC protos
Co-authored-by: Andrey Savitskiy <taketa@users.noreply.github.com>
Co-authored-by: Valentine Wallace <valentine.m.wallace@gmail.com>
2018-08-21 18:00:08 -07:00
Olaoluwa Osuntokun
e5a61183b5
Merge pull request #1757 from cfromknecht/parallel-link-shutdown
htlcswitch/switch: shutdown links concurrently
2018-08-21 17:17:24 -07:00
Conner Fromknecht
5d131e5164
htlcswitch/link_test: assert delete spurious response 2018-08-21 17:13:58 -07:00
Conner Fromknecht
6a8507cfb5
htlcswitch/switch: ignore pending/local responses on reforward 2018-08-21 17:13:58 -07:00
Conner Fromknecht
81b4af2ec8
htlcswitch/link: cleanup spurious fail/settle responses 2018-08-21 17:13:58 -07:00
Wilmer Paulino
2f644d9b62
chainntnfs/neutrinonotify: disable disconnected block ntfns while
rescanning

In this commit, we modify the rescan options Neutrino uses when
performing a rescan for historical chain events to disable disconnected
block notifications. This is needed as the Neutrino backend will mutate
its internal state while rewinding, which causes disconnected block
notifications to be sent. Since the notifier acts upon these
notifications, they would cause it to also rewind unnecessarily.
2018-08-21 13:02:17 -04:00
Wilmer Paulino
96a079873a
test: remove sleep timeouts used within channel force closure
In this commit, we remove the sleep timeouts used within the channel
force closure integration test. This is needed because the recent changes
within the ChainNotifier require a longer timeout due to making a
database transaction on every new block to update the confirm/spend
hints of transactions. Rather than increasing the timeouts, we simply
remove them to ensure this isn't an issue down the road.
2018-08-21 13:02:16 -04:00
Wilmer Paulino
2931b2d3b2
lnwallet: add height hint cache to backend tests 2018-08-21 13:02:15 -04:00
Wilmer Paulino
4c2a0970b4
chainregistry: modify backends to use a height hint cache 2018-08-21 13:02:15 -04:00
Wilmer Paulino
94beabf34b
chainntnfs: cache spend hints within the different chain notifiers
In this commit, we extend the different ChainNotifier implementations to
cache height hints for our spend events. Each outpoint we've requested a
spend notification for will have its initial height hint cached. We then
increment this height hint at every new block for unspent outpoints.
This allows us to retrieve the *exact* height at which the outpoint has
been spent. By doing this, we optimize the different ChainNotifier
implementations since they will no longer have to rescan forward (and
possibly fetch blocks in the neutrino/pruned node case) from the initial
height hint.
2018-08-21 12:55:53 -04:00
Wilmer Paulino
7e872566c4
chainntnfs: query the hint cache before registering a conf ntfn
In this commit, we alter the different chain notifiers to query their
height hint cache before registering a confimation notification. We do
this as it's possible that the cache has a higher height hint, which
can potentially reduce the amount of blocked fetched when attempting
historical dispatches.
2018-08-21 12:55:52 -04:00
Wilmer Paulino
30fd219b1c
chainntnfs: add height hint caches to chain notifiers 2018-08-21 12:55:51 -04:00