Commit Graph

430 Commits

Author SHA1 Message Date
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
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
Olaoluwa Osuntokun
f028eaa152
Merge pull request #1698 from cfromknecht/switch-fwdpkg-cleanup
[htlcswitch] fwdpkg cleanup
2018-08-21 18:56:15 -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
Conner Fromknecht
4e093a6cd2
htlcswitch/switch: shutdown links concurrently 2018-08-20 22:05:05 -07:00
Wilmer Paulino
44e97ee72f htlcswitch: remove no longer needed destNode field in htlcPacket 2018-08-20 21:04:52 -07:00
Wilmer Paulino
7535371238 htlcswitch: implement strict forwarding for locally dispatched payments
In this commit, we address an issue that could arise when using the
SendToRoute RPC. In this RPC, we specify the exact hops that a payment
should take. However, within the switch, we would set a constraint for
the first hop to be any hop as long as the first peer was at the end of
it. This would cause discrepancies when attempting to use the RPC as the
payment would actually go through another hop with the same peer. We fix
this by explicitly specifying the channel ID of the first hop.

Fixes #1500.
Fixes #1515.
2018-08-20 21:04:47 -07:00
Conner Fromknecht
53b58a1eb3
htlcswitch/mock: drop messages if link is not online
In this commit, we modify the readHandler w/in
the mock peer to drop messages if it is unable
to find the target link. This has led to observed
race conditions related to removing a link and still
attempting to deliver messages. By removing this,
the readHandler shouldn't fail the test as a result.
2018-08-20 19:23:15 -07:00
Conner Fromknecht
f636ff8b4a
htlcswitch/test_utils: bump fwdpkg gc timeout to 15s
This commit increases the fwdpkg garbage collection
interval to 15s, to mitigate the likelihood of it
interfering with our unit tests related to fwdpkgs.
2018-08-20 18:48:49 -07:00
Conner Fromknecht
4f2137eafc
htlcswitch/switch: set SourceRef of failed packets 2018-08-20 18:47:03 -07:00
Conner Fromknecht
cd7e4f98c0
htlcswitch/link_test: check fwdpkg cleanup for failed adds 2018-08-20 18:46:59 -07:00
Conner Fromknecht
3fb6a310f8
htlcswitch/link: remove circuit deletion forgiveness
This commit removes the concept of "circuit deletion
forgivness" from the link. This was originally
implemented due to the strict semantics of the original
DeleteCircuit implementation, which would fail if we tried
to delete unknown circuits. Forgivness is used on startup
to ignore this error in case the circuits had already been
deleted before shutting down.

Now that the circuit deletion has been relaxed, this
behavior is no longer necessary, as requests to delete
unknown (or previously deleted) circuits will be ignored.

This is necessary for future changes regarding switch
cleanup, which may attempt to cleanup already deleted
circuits.
2018-08-20 16:45:42 -07:00
Conner Fromknecht
78439416c0
htlcswitch/circuit_test: test for relaxed DeleteCircuits
Modify unit tests to expect success when removing
already-deleted circuits, as well as test that extra
circuit deletions are ignored.
2018-08-20 16:45:42 -07:00
Conner Fromknecht
a213810563
htlcswitch/circuit_map: prune stray locally-initiated keystones 2018-08-20 16:45:42 -07:00
Conner Fromknecht
c2055d4a9e
htlcswitch/circuit_map: relax circuit deletion
Previously, we would only allow deletion of circuits if all circuit keys
were found in the pending map.

In this commit, we relax this to allow for deletion of any circuits
that are found pending, and ignore those that are not found. This
is a preliminary step to cleaning up duplicate forwards that get caught
by the switch. It also allows us to gracefully handle any nodes that
are still afflicted by the split mailbox issue.
2018-08-20 16:45:42 -07:00
Conner Fromknecht
0372bf9319
htlcswitch/circuit_map: prevent spewing secp curve in trace
Replaces the log statement in CommitCircuits so that
it prints the circuit key of the incoming channel. This way
we avoid spewing the secp curve stored in the ErrorEncrypter.
2018-08-20 16:45:42 -07:00
Conner Fromknecht
48b616629a
htlcswitch/switch: remove unnecessary defer closure 2018-08-18 20:19:17 -07:00
Conner Fromknecht
9047eee2f1
htlcswitch/switch: adds concrete ErrSwitchExisting 2018-08-18 20:19:17 -07:00
Conner Fromknecht
0d49a60924
htlcswitch/switch: remove go-errors pkg 2018-08-18 20:19:17 -07:00
Johan T. Halseth
887722f38f
htlcswitch/switch: add method HasActiveLink 2018-08-17 23:24:12 +02:00
Olaoluwa Osuntokun
7a113d469b
Merge pull request #1551 from cfromknecht/switch-revert-replace-link
[htlcswitch]: revert replace link, ensure removed links are stopped
2018-08-13 21:44:42 -07:00
Conner Fromknecht
f84cd14b12
htlcswitch/switch: permit link shutdown mid-forwarding
In this commit, we thread through a link's quit channel into
routeAsync, the primary helper method allowing links to send
htlcPackets through the switch. This is intended to remove
deadlocks from happening, where the link is synchronously
blocking on forwarding packets to the switch, but also
needs to shutdown.
2018-08-10 11:42:26 -07:00
Conner Fromknecht
0fef1c71fe
htlcswitch/link: pass link quit to ForwardPackets 2018-08-10 11:42:26 -07:00
Conner Fromknecht
d08003b285
htlcswitch/link_test: adds TestChannelLinkShutdownDuringForward
This commit adds a test that verifies Stop does not block
if the link is concurrently forwarding incoming Adds to
the switch. This test fails prior to the commits that
thread through the link's quit channel.
2018-08-10 11:42:26 -07:00
Conner Fromknecht
11f02de3b3
htlcswitch/link_test: removes unnecessary WaitForShutdown
The new RemoveLink method blocks until the link has
been fully stopped, so we no longer need to wait
for it explicitly.
2018-08-10 11:42:25 -07:00
Conner Fromknecht
b507d265b4
htlcswitch/link: only update contract signals on start if live link 2018-08-10 11:42:25 -07:00
Conner Fromknecht
c78e81d32b
htlcswitch/switch: synchronous stop of links after removal 2018-08-10 11:42:25 -07:00
Conner Fromknecht
258019eb24
htlcswitch/switch_test: update reverted test to use...
current initialization methods
2018-08-10 11:42:24 -07:00
Conner Fromknecht
1113684dc3
Revert "htlcswitch: in event of duplicate link add, prefer newer link"
This reverts commit e60d2b774a35e446081f9be2d4901925cac05379.
2018-08-10 11:42:20 -07:00
Valentine Wallace
1ffc3bb82e
multi: update to latest RegisterBlockEpochNtfn interface 2018-08-10 01:08:57 -07:00
Olaoluwa Osuntokun
518b0d2cf7
Merge pull request #1679 from cfromknecht/move-linter-v2
Makefile: move linter v2
2018-08-09 21:03:05 -07:00
Olaoluwa Osuntokun
d3b1b9aa98
Merge pull request #1668 from cfromknecht/interface-tickers
Ticker Package
2018-08-09 20:55:25 -07:00
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -07:00
Conner Fromknecht
c90ec19595
htlcswitch/test_utils: repalce mockTicker with new MockTicker 2018-08-09 02:48:07 -07:00
Conner Fromknecht
6a709526d8
htlcswitch/mock: remove mockTicker, use ticker.MockNew 2018-08-09 02:48:07 -07:00
Conner Fromknecht
2651136806
htlcswitch/link_test: replace mockTicker with ticker.Mock 2018-08-09 02:48:07 -07:00
Conner Fromknecht
e3253a4f3b
htlcswitch/switch: add log/fwd event tickers to Config 2018-08-09 02:48:07 -07:00
Conner Fromknecht
1c456a5144
htlcswitch/link: replace batch ticker with...
resumable ticker.Ticker interface
2018-08-09 02:48:06 -07:00
Conner Fromknecht
b608fca447
htlcswitch/circuit_test: use CircuitKey field names 2018-08-07 16:57:40 -07:00
Conner Fromknecht
cf2c371042
multi: fix linting errors 2018-08-02 18:20:50 -07:00
Conner Fromknecht
1ded697e8d
multi: sort import paths with gofmt 2018-08-02 18:20:49 -07:00