Commit Graph

17 Commits

Author SHA1 Message Date
Conner Fromknecht
55f90be2a5
htlcswitch/mailbox: rename Settle/Fail queue to indicate replies
This commit renames the variables associated with processing the
Settle/Fail packets to indicate that they are replies.
2020-04-14 10:51:48 -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
63f3d0b012
htlcswitch/mailbox: advance packet head after delivery
This commit delays the advancement of the pktHead until after the
message has been delivered. This is a prepatory step, as in the future
we may fail to deliver the packet due to a deadline expiring.
2020-04-14 10:48:59 -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
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
Joost Jager
3d7de2ad39
multi: remove dead code 2019-09-10 17:21:59 +02:00
Federico Bond
0a9141763e multi: replace manual CAS with sync.Once in several more modules 2019-06-12 09:37:26 -03:00
maurycy
3be08e69cf multi: 64bit aligment of atomic vars on arm/x86-32 2018-06-04 20:02:34 -07:00
Conner Fromknecht
c290398b4b
htlcswitch/mailbox: adds mailOrchestrator 2018-05-09 16:07:51 -07:00
Olaoluwa Osuntokun
1af8fa9367
htlcswitch: add additional comments and logging 2018-03-12 18:58:44 -07:00
Conner Fromknecht
9b00f83656
htlcswitch/mailbox: makes pkts replayable via Reset 2018-03-09 21:08:43 -08:00
Olaoluwa Osuntokun
9cb3657314
htlcswitch: add new ProcessContractResolution method
In this commit, we add a new method: ProcessContractResolution. This
will be used by entities of the contract court package to notify us
whenever they discover that we can resolve an incoming contract
off-chain after the outgoing contract was fully resolved on-chain.

We’ll take a contractcourt.ResolutionMsg and map it to the proper
internal package so we can fully resolve an active circuit.
2018-01-22 19:19:38 -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