Commit Graph

14 Commits

Author SHA1 Message Date
Roei Erez
1a6701122c htlcswitch: change ForwardPackets to return error
As part of the preparation to the switch interceptor feature, this
function is changed  to return error instead of error channel that
is closed automatically.
Returning an error channel has become complex to maintain and
implement when adding more asynchronous flows to the switch.
The change doesn't affect the current behavior which logs the
errors as before.
2020-06-18 12:48:21 +03:00
Conner Fromknecht
6ec2cc5669
htlcswitch/mailbox_test: use mailboxContext everywhere
Modifies some of the older mailbox tests that were left untouched as of
PR #4174 to use the new mailbox test context. This ensures that the
config members of each mailbox's config are properly initialized. In
certain instances where travis is slow, this would cause test panics.
2020-04-20 15:37:33 -07:00
Conner Fromknecht
16ad0274c9
htlcswitch/mailbox: fail on duplicate adds 2020-04-14 10:50:25 -07:00
Conner Fromknecht
e7ece11c29
htlcswitch/mailbox: fail htlcs when delayed for 1 minute
Now that packet failure is handled by the mailbox, we can now enforce
a delivery deadline and fail the packet if it the deadilne is exceeded.
This gives senders quicker feedback about tried routes, and allows them
to try alternative paths to the destination in the meantime.
2020-04-14 10:50:07 -07:00
Conner Fromknecht
1aa2dde4a4
htlcswithc/mailbox: prioritize settles/fails over adds
This commit splits the packet courier internally into two distinct
queues, one for adds and one for settles+fails. This allows us to
prioritize HTLCs that will clear the commitment transaction and make
space for adds. Previously this responsibility was handled by the
overflow queue.
2020-04-14 10:49:48 -07:00
Conner Fromknecht
37dca27a3d
htlcswitch: thread clock from switch to mailbox 2020-04-14 10:49:26 -07:00
Conner Fromknecht
564534c829
htlcswitch: move packet failure to mailbox
This commit moves the current logic for sending failures out of the link
and into the mailbox in preparation for our failing delayed htlcs. We do
so because the mailbox may need to fail packets while the link is
offline, and needs to be able to complete the task without member
methods on the link.
2020-04-14 10:48:40 -07:00
Conner Fromknecht
f3051efeb3
htlcswitch/mailbox: block until mailbox shutdown
Fixes a bug where Stop() wouldn't actually wait for the mailbox to exit.
2020-04-14 10:48:06 -07:00
Conner Fromknecht
57551fbd74
htlcswitch/mailbox_test: add orchestrator pending/live test 2018-05-09 16:07:52 -07:00
Conner Fromknecht
3ae7772ecb
htlcswitch/mailbox_test: adds checks for reset and replay of pkts 2018-03-09 21:08:43 -08:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Jim Posen
88dc73adb0 htlcswitch: Fix failure error handling on outgoing adds. 2017-12-14 17:53:58 -08:00
Jim Posen
4a29fbdab2 htlcswitch: Rename htlcPacket fields for clarity.
The src/dest terminology for routing packets is kind of confusing
because the source HTLC may not be the source of the packet for
settles/fails traversing the circuit in the opposite direction. This
changes the nomenclature to incoming/outgoing and always references
the HTLCs themselves.
2017-12-14 17:53:58 -08:00
Olaoluwa Osuntokun
890559edfa
htlcswitch: add new mailBox abstraction to the package
In this commit, we add a new abstraction to the package: the mailBox.
The mailBox is a non-blocking, concurrent safe, in-order queue for
delivering messages to a given channelLink instance. With this
abstraction in place, we can now allow the switch to no longer launch a
new goroutine for each forwarded HTLC, or instantiated user payment.
2017-11-10 19:51:01 -08:00