Commit Graph

445 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
53416260e3
htlcswitch: update test to account for new ChainNotifier API 2018-07-31 21:28:58 -07:00
Olaoluwa Osuntokun
3268019326
htlcswitch: update mock notifier due to recent API changes 2018-07-31 21:28:50 -07:00
Olaoluwa Osuntokun
1e39cfc65f
Merge pull request #1364 from halseth/data-loss-protect
Data loss protection
2018-07-31 20:53:42 -07:00
Johan T. Halseth
ebed786b2a
htlcswitch/link: inspect sync errors, force close channel
This commit makes the link inspect the error encountered during channel
sync, force closing the channel if we detect a remote data loss.
2018-07-31 15:16:23 +02:00
Johan T. Halseth
22e21da370
htlcswitch tests: add missing OnChannelFailure to test link configs 2018-07-31 08:27:03 +02:00
Conner Fromknecht
3ed2241a94
htlcswitch/link_test: only pass duration to NewBatchTicker 2018-07-30 22:33:37 -07:00
Conner Fromknecht
5af19bb2b4
htlcswitch/link: reusable BatchTicker
This commit modifies the default BatchTicker
implementation such that it will generate a
new ticker with each call to Start(). This
allows us to create a new ticker after
releasing an old one due to the batch
being empty.
2018-07-30 22:33:37 -07:00
Conner Fromknecht
bd9a6bd625
htlcswitch/link: conditional batch ticker
In this commit, we prevent the htlcManager from
being woken up by the batchTicker when there is no
work to be done. Profiling has shown a significant
portion of CPU time idling, since the batch ticker
endlessly demands resources. We resolve this by only
selecting on the batch ticker when we have a
non-empty batch of downstream packets from the
switch.
2018-07-30 21:44:49 -07:00
Conner Fromknecht
d76bacee0e
htlcswitch/link: send FailFinalExpiryTooSoon from exit hop
This commit corrects our exit hop logic to return
FailFinalExpiryTooSoon if the following check is true:
   pd.Timeout-expiryGraceDelta <= heightNow

Previously we returned FailFinalIncorrectCltvExpiry, which
should only be returned if the packet was misconstructed.
2018-07-27 15:52:09 -07:00
Conner Fromknecht
982a09ac60
htlcswitch/link_test: check for FailFinalExpiryTooSoon 2018-07-27 15:50:00 -07:00
Conner Fromknecht
a5e841c6b7
htlcswitch/hodl/config_production: hide cli hodl flags in prod
This commit replaces the debug Config struct with an empty
one, so that the command line flags are hidden in production
builds.

Production help before commit:

Tor:
      --tor.active
      --tor.socks=
      --tor.dns=
      --tor.streamisolation
      --tor.control=
      --tor.v2
      --tor.v2privatekeypath=
      --tor.v3

hodl:
      --hodl.exit-settle
      --hodl.add-incoming
      --hodl.settle-incoming
      --hodl.fail-incoming
      --hodl.add-outgoing
      --hodl.settle-outgoing
      --hodl.fail-outgoing
      --hodl.commit
      --hodl.bogus-settle

Help Options:
  -h, --help

Production help after commit:

Tor:
      --tor.active
      --tor.socks=
      --tor.dns=
      --tor.streamisolation
      --tor.control=
      --tor.v2
      --tor.v2privatekeypath=
      --tor.v3

Help Options:
  -h, --help
2018-07-25 03:33:36 -07:00
Conner Fromknecht
0df2bcd18c
htlcswitch/hodl/config_debug: only expose hodl flags in debug
This commit places hodl command line flags behind the debug flag,
so that they're only accessible during testing builds.
2018-07-25 03:30:12 -07:00
Johan T. Halseth
d7b2977e8c
multi test: remove mempool bool from RegisterSpendNtfn 2018-07-22 23:09:08 +02:00
Wilmer Paulino
3ab17063ff
multi: satisfy new lnpeer interface 2018-07-19 12:32:29 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Olaoluwa Osuntokun
a32f2b79da
htlcswitch: modify the InvoiceDatabase interface to allow specifying final payment amt
In this commit, we modify the InvoiceDatabase slightly to allow the link
to record what the final payment about for an invoice was. It may be the
case that the invoice actually had no specified value, or that the payer
paid more than necessary. As a result, it's important that our on-disk
records properly reflect this.

To fix this issue, the SettleInvoice method now also accepts the final
amount paid.

Fixes #856.
2018-07-06 12:21:55 -07:00
Olaoluwa Osuntokun
0a045f8651
Merge pull request #1482 from cfromknecht/uniform-fee-update-timeout
htlcswitch/link: correct bias in fee update backoff
2018-07-03 22:27:22 -05:00
Olaoluwa Osuntokun
d889644f52
htlcswitch: use Batch for calls within ackSettleFail 2018-06-30 17:15:31 -05:00
Olaoluwa Osuntokun
3ad15c5f42
hltcswitch: use a logClosure to delay spew evaluation until log print time 2018-06-30 17:15:04 -05:00
Conner Fromknecht
12f74f762d
htlcswitch/test_utils: use realistic link timeouts 2018-06-30 11:51:47 -07:00
Conner Fromknecht
10ecf2307f
htlcswitch/link_test: use realistic link timeouts 2018-06-30 11:42:36 -07:00
Conner Fromknecht
5fa8124aa1
htlcswitch/link: correct bias in fee update backoff
This commit corrects the distribution used to
schedule a link's randomized backoff for fee
updates. Currently, our algorithm biases the
lowest value in the range, with probability
equal to lower/upper, or the ratio of the lower
bound to the upper. This distribution is skewed
more heavily as lower approaches upper.

The solution is to sample a random value in the
range upper-lower, then add this to our lower
bound. The effect is a uniformly distributed
timeout in [lower, upper).
2018-06-30 10:22:38 -07:00
Olaoluwa Osuntokun
2196d9375e
htlcswitch: obtain the min final CLTV delta directly from the InvoiceDatabase
In this commit, we modify the existing logic that would attempt to read
the min CLTV information from the invoice directly. With this route, we
avoid any sort of DB index modifications, as this information is already
stored within the payment request, which is already available to the
outside callers. By modifying the InvoiceDatabase interface, we avoid
having to make the switch aware of what the "primary" chain is.
2018-06-29 16:03:13 -07:00
Olaoluwa Osuntokun
3a47c41c6b
Merge pull request #1448 from Roasbeef/check-invoice-min-final
channeldb+htlcswitch: use the final min cltv delta in the invoice when link at exit hop
2018-06-28 18:39:33 -07:00
Conner Fromknecht
e85fa1af96
htlcswitch/decayedlog_test: fix bug in gc unit test
This commit fixes a bug in the
TestDecayedLogPersistentGarbageCollector unit test.
The test generates a second hash prefix, which is never
added to the log, and used to query for the final
existence check. This commit reverts the behavior so
that the same hash prefix is used throughout the test.
2018-06-27 14:40:28 -07:00
Olaoluwa Osuntokun
a2f0d6d38e
htlcswitch: use the delta within the time lock, not the default policy at exit node
In this commit, we fix a lingering bug within the link when we're the
exit node for a particular payment. Before this commit, we would assert
that the invoice gives us enough of a delta based on our current routing
policy. However, if the invoice was generated with a lower delta, or
we've changed from the default routing policy, then this would case us
to fail back any payments sent to us.

We fix this by instead using the newly available final CLTV delta
information within the extracted invoice.

Fixes #1431.
2018-06-26 19:50:04 -07:00
Olaoluwa Osuntokun
ec7cfc6906
Merge pull request #1447 from Roasbeef/forwarding-timelock-fix
routing+htlcswitch: finalize switch of CLTV delta directionality in path finding and link forwarding
2018-06-26 19:47:46 -07:00
Conner Fromknecht
66c4240234
htlcswitch/link: add WaitForShutdown method for testing 2018-06-26 18:28:54 -07:00
Conner Fromknecht
23f2d93402
htlcswitch/link_test: wait for link shutdown after removal 2018-06-26 18:28:53 -07:00
Olaoluwa Osuntokun
bdecc5bea9
htlcswitch: update forwarding policy verification to use new time lock info 2018-06-26 17:29:42 -07:00
Olaoluwa Osuntokun
7b4c150983
htlcswitch: add new incoming+outgoing timeout fields to htlcPacket 2018-06-26 17:29:41 -07:00
Olaoluwa Osuntokun
2bb5931bb7
htlcswitch: move timelock policy verification logic to HtlcSatifiesPolicy
In this commit, we extract the time lock policy verification logic from
the processRemoteAdds method to the HtlcSatifiesPolicy method. With this
change, we fix a lingering bug within the link: we'll no longer verify
time lock polices within the incoming link, instead we'll verify it at
forwarding time like we should. This is a bug left over from the switch
of what the CLTV delta denotes in the channel update message we made
within the spec sometime last year.
2018-06-26 17:29:41 -07:00
Olaoluwa Osuntokun
74ec9147b1
htlcswitch: extend the HtlcSatifiesPolicy to also accept timelock/height info
In this commit, we extend the existing HtlcSatifiesPolicy method to also
accept timelock and height information. This is required as an upcoming
commit will fix an existing bug in the forwarding logic wherein we use
the time lock policies of the incoming node rather than that of the
outgoing node.
2018-06-26 17:29:40 -07:00
Olaoluwa Osuntokun
6e051a80ff
htlcswitch: fix bug in generateHops, use CLTV delta of prior hop to compute payload
In this commit, we fix a bug in the generateHops helper function. Before
this commit, it erroneously used the CLTV delta of the current hop,
rather than that of the prior hop when computing the payload. This was
incorrect, as when computing the timelock for the incoming hop, we need
to factor in the CTLV delta of the outgoing lock, not the incoming lock.
2018-06-26 17:29:40 -07:00
Olaoluwa Osuntokun
4eb07e8288
htlcswitch: add new TestForwardingAsymmetricTimeLockPolicies test
In this commit, we add a new test to the switch:
TestForwardingAsymmetricTimeLockPolicies. This test ensures that a link
has two channels, one of which has a greater CLTV delta than the latter,
that a payment will successfully be routed across the channels. Atm, the
test fails (including the fix to hop payload generation included in the
next commit).

Atm, due to the way that we check forwarding policies, we'll reject this
payment as we're attempting to enforce the policy of the incoming link
(cltv delta of 7), instead of that of the outgoing link (cltv delta of
6). As a result, atm, the incoming link checks if (incoming_timeout -
delta < outgoing_timeout). For the values in the test case: 112 - 7 <
106 -> 105 < 106, this check fails. The payload is proper, but the check
itself should be applied at the outgoing hop.
2018-06-26 17:29:39 -07:00
Olaoluwa Osuntokun
19a0eab804
htlcswitch: in removeLink use new goroutine to stop existing link
In this commit, we modify the removeLink method to be more asynchronous.
Before this commit, we would attempt to block until the peer exits.
However, it may be the case that at times time, then target link is
attempting to forward a batch of packets to the switch (forwardBatch).
Atm, this method doesn't pass in an external context/quit, so we can't
cancel this message/request. As a result, we'll now ensure that
`removeLink` doesn't block, so we can resume the switch's main loop as
soon as possible.
2018-06-25 16:04:24 -07:00
yohei okada
7b37cbd2d9
htlcswitch: add basic table driven tests for ExpectedFee 2018-06-15 17:29:02 +09:00
Olaoluwa Osuntokun
1e8a5104ba
Merge pull request #1338 from Roasbeef/packet-queue-exit
htlcswitch: ensure the packet queue exits on stop
2018-06-13 19:17:12 -07:00
Wilmer Paulino
8198466972
multi: move block epochs dependency from links to switch
In this commit, we move the block height dependency from the links in
the switch to the switch itself. This is possible due to a recent change
on the links no longer depending on the block height to update their
commitment fees.

We'll now only have the switch be alerted of new blocks coming in and
links will retrieve the height from it atomically.
2018-06-13 17:41:21 -07:00
Wilmer Paulino
4cc60493d2
peer+htlcswitch: randomize link commitment fee updates
In this commit, we modify the behavior of links updating their
commitment fees. Rather than attempting to update the commitment fee for
each link every time a new block comes in, we'll use a timer with a
random interval between 10 and 60 minutes for each link to determine
when to update their corresponding commitment fee. This prevents us from
oscillating the fee rate for our various commitment transactions.
2018-06-13 17:41:01 -07:00
Olaoluwa Osuntokun
e60d2b774a
htlcswitch: in event of duplicate link add, prefer newer link 2018-06-12 00:44:30 -07:00
Olaoluwa Osuntokun
3db06cf7d5
htlcswitch: in removeLink properly remove items from the interfaceIndex
In this commit, we fix a bug in the way we handle removing items from
the interfaceIndex. Before this commit, we would delete all items items
with the target public key that of the peer that owns the link being
removed. However, this is incorrect as the peer may have other links
sill active.

In this commit, we fix this by first only deleting the link from the
peer's index, and then checking to see if the index is empty after this
deletion. Only if so do we delete the index for the peer all together.
2018-06-11 23:06:22 -07:00
Olaoluwa Osuntokun
03810603ee
htlcswitch: modify interfaceIndex to no longer key 2nd lvl by ChannelLink
In this commit, we modify the interfaceIndex to no longer key the second
level of the index by the ChannelLink. Instead, we'll use the chan ID as
it's a stable identifier, unlike a reference to an interface.
2018-06-11 23:02:16 -07:00
Olaoluwa Osuntokun
2e838abb3f
Merge pull request #1350 from cfromknecht/switch-duplicate-links
Switch duplicate links
2018-06-10 18:13:26 -07:00
Conner Fromknecht
e5233c8ec7
htlcswitch/switch: reject duplicate links, purge link indexes 2018-06-09 04:33:04 -07:00
Conner Fromknecht
a779befda5
htlcswitch/switch_test: adds duplicate link add test 2018-06-09 04:28:03 -07:00
Conner Fromknecht
4dace6c941
htlcswitch/multi: update tests for lnpeer.Peer iface 2018-06-08 16:29:49 -07:00
Conner Fromknecht
4380c67124
htlcswitch/link: upgrade to use lnpeer.Peer.SendMessage 2018-06-08 16:29:49 -07:00
Conner Fromknecht
3046ea6c5b
htlcswitch/interfaces: removes Peer iface, use new lnpeer.Peer 2018-06-08 16:29:48 -07:00
Olaoluwa Osuntokun
b2e24f876b
htlcswitch: ensure the packet queue exits on stop
In this commit, we ensure that the packet queue will always exit, by
continually signalling the main goroutine until it atomically sets a
bool that indicates its has been fully shutdown. It has been observed
that at times the main goroutine will wake up (due to the signal), but
then bypass the select and actually miss the quit signal, as a result
another signal is required. We'll continue to signals in a lazy loop
until the goroutine has fully exited.
2018-06-08 13:51:37 -07:00
Olaoluwa Osuntokun
4bde4c1c26
Merge pull request #1333 from Roasbeef/min-fee-rate
funding+htlcswitch: enforce min fee rate of 253 sat/kw on commitments
2018-06-06 21:00:13 -07:00
Conner Fromknecht
c180065a84
htlcswitch/link: remove deadlock in htlc validation
This commit removes a possible deadlock in the switch,
which can be triggered under certain failure conditions.
Previously, we would acquire the link's read lock for
the duration of HtlcSatisfiesPolicy, though we only
need to use it grab the current policy. The deadlock could
be caused in the cases where we attempt to log the failure,
which access the read-protected ShortChanID method.
2018-06-06 18:11:36 -07:00
Olaoluwa Osuntokun
8f68d0e605
funding+htlcswitch: enforce min fee rate of 253 sat/kw on commitments
In this commit, we add and enforce a min fee rate for commitment
transactions created, and also any updates we propose to the remote
party. It's important to note that this is only a temporary patch, as
nodes can dynamically raise their min fee rate whenever their mempool is
saturated.

Fixes #1330.
2018-06-05 17:50:50 -07:00
Olaoluwa Osuntokun
4af9da40c5
htlcswitch: fix alignment in packetQueue for ARM
Fixes #1328.
2018-06-05 12:55:06 -07:00
maurycy
3be08e69cf multi: 64bit aligment of atomic vars on arm/x86-32 2018-06-04 20:02:34 -07:00
Conner Fromknecht
d62d142d18
htlcswitch/decayedlog_test: create unique test dbs
This commit changes the decayed log tests to create
a new temporary database for each test. Previously, all
instances referenced the same db path. Since the tests
are run in parallel, the tests would create/delete the
shared db out from under each other, causing flakes in
the unit tests.
2018-05-31 16:05:02 -07:00
Johan T. Halseth
4dfb4547a0
htlcswitch: remove unused Disconnect from Peer interface 2018-05-25 06:58:24 +02:00
Johan T. Halseth
f95ae1cdd6
htlcswitch/link: add failed variable to ensure exit 2018-05-25 06:58:24 +02:00
Johan T. Halseth
49fd3f34d4
htlcswitch/link: settle with fake preimage if BogusSettle active 2018-05-25 06:58:24 +02:00
Johan T. Halseth
71a1aae417
htlcswitch/hodl: add flag BogusSettle
This commit adds a new hodl flag "BogusSettle" which will be used to
emulate a node trying to settle back an incoming HTLC with a fake
preimage.
2018-05-25 06:58:23 +02:00
Johan T. Halseth
88670175c7
htlcswitch/link_test: add TestChannelLinkFail 2018-05-25 06:58:23 +02:00
Johan T. Halseth
9a47494517
htlcswitch/link_test: extract adding link to switch 2018-05-25 06:58:23 +02:00
Johan T. Halseth
fbec83699c
htlcswitch/link: make fail() call OnChannelFailure with LinkFailureError
Adds a new closure OnChannelFailure to the link config, which is called
when the link fails. This function closure should use the given
LinkFailureError to properly force close the channel, send an error to
the peer, and disconnect the peer.
2018-05-25 06:58:23 +02:00
Johan T. Halseth
92afcbe3f4
htlcswitch/linkfailure: define LinkFailureError
This commit introduces a new error type LinkFailureError which is used
to distinguish the different kinds of errors that we can encounter
during link operation. It encapsulates the information necessary to
decide how we should handle the error.
2018-05-25 06:58:18 +02:00
Olaoluwa Osuntokun
b60575fdac
htlcswitch: run decay log tests in parallel 2018-05-22 16:55:08 -07:00
Olaoluwa Osuntokun
5e3b239ebc
htlcswitch: ensure we don't attempt to create fwding events for fails
In this commit, we fix an existing source of a panic, that could at
times lead to a deadlock. If the circuit returned from closeCircuit
didn't have an outgoing key (as it was an incomplete forward), then we
would attempt to de-ref a nil pointer. This would trigger a panic, and
the runtime would start to unwind the stack, and execute each defer in
line. A deadlock can arise here, as in the defer at the root goroutine,
we need to grab the fwdingEventMtx. However, we already have it at the
panic site.

We fix this issue by ensuring we only attempt to add the event if it's a
_settle_ and also actually has an outgoing circuit (which it should
already, just a defensive check).
2018-05-22 16:46:55 -07:00
Olaoluwa Osuntokun
b73eef12b3
Merge pull request #945 from jimpo/decayedlog
Move DecayedLog from lightning-onion to htlcswitch.
2018-05-10 20:06:53 -07:00
Conner Fromknecht
57551fbd74
htlcswitch/mailbox_test: add orchestrator pending/live test 2018-05-09 16:07:52 -07:00
Conner Fromknecht
418983cadc
htlcswitch/switch_test: test send pending channel 2018-05-09 16:07:51 -07:00
Conner Fromknecht
c290398b4b
htlcswitch/mailbox: adds mailOrchestrator 2018-05-09 16:07:51 -07:00
Conner Fromknecht
d3403306b6
htlcswitch/switch: segment pending links from live links 2018-05-09 16:07:51 -07:00
Conner Fromknecht
1dace1fed4
htlcswitch/mock: impl UpdateShortChanID w/ error 2018-05-09 16:07:25 -07:00
Conner Fromknecht
3e46a5e815
htlcswitch/link: fix UpdateShortChanID 2018-05-09 16:07:25 -07:00
Conner Fromknecht
b5591cd66c
htlcswitch/interfaces: return err from UpdateShortChanID 2018-05-09 16:06:49 -07:00
Conner Fromknecht
f963f91a3c
multi: use mutex-guarded ShortChanID() on OpenChannel 2018-05-09 16:06:49 -07:00
Conner Fromknecht
7ad56943c7
channeldb/channel: adds RefreshShortChanID 2018-05-09 16:06:49 -07:00
Johan T. Halseth
854e2a0581
link test: add TestChannelLinkWaitForRevocation
This commit adds a test where we trigger a situation which would
previously make the link think it was never in sync, and potentially
create a lot of empty state updates. This would happen if we were
waiting for a revocation, while still receiving updates from the remote.
Since in this case we could not ACK the updates because of the exhausted
revocation window, our local commitchain would extend, while the remote
chain would stall. When we finally got the revocation the local
commitment height would be far larger than the remote, and FullySynced
would return false from that point on.
2018-05-09 08:47:21 +02:00
Johan T. Halseth
db254c1258
link test: add TestChannelLinkNoMoreUpdates
This commit adds a new test that makes sure we don't try to send
commitments for states where there are now new updates. Before the
recent change to FullySynced we would do this in this test scenario, as
the local an remote commitment heights would differ.

The test makes the local commitment chain extend by 1 vs the remote,
which would earlier trigger another state update, and checks taht no
such state update is made.
2018-05-09 08:47:21 +02:00
Olaoluwa Osuntokun
ddcbb40898
Merge pull request #1206 from wpaulino/temp-chan-failure-update
htlcswitch+server: ensure we always send an update w/ a TempChannelFailure
2018-05-08 19:33:20 -07:00
Conner Fromknecht
de9de771bb
htlcswitch/link: ensure circuits are committed in-order
This commit makes the call to forwardBatch after locking
in Adds synchronous. This ensures that circuits for any Add
packets are added to the switch in the same order that they
are prescribed in the channel state. Though it is very unlikely
this case would arise, it may happen under more greater loads.

In addition, this also makes some trivial optimizations wrt. to
not spawning unnecessary goroutines if no settle/fail packets
are locked in.
2018-05-08 16:37:35 -07:00
Olaoluwa Osuntokun
72f48b6abe
htlcswitch+server: ensure we always send an update w/ a TempChannelFailure
In this commit, we ensure that any time we send a TempChannelFailure
that's destined for a multi-hop source sender, then we'll always package
the latest channel update along with it.
2018-05-08 13:00:28 -04:00
littleskunk
d2a6c4eec9 htlcswitch: typo fix 2018-05-07 21:33:32 -07:00
Olaoluwa Osuntokun
ddd12eff9c
htlcswitch: move link trimming to link start up
In this commit, we fix a race in the set of TestChannelLinkTrimCircuits*
tests. Before this commit, we would trim the circuits in the htlcManager
goroutine. However, this was problematic as the scheduling order of
goroutines isn't predictable. Instead, we'll now trim the circuits in
the Start method.

Additionally, we fix a series of off-by-2 bugs in the tests themselves.
2018-05-03 20:11:52 -07:00
Conner Fromknecht
42a9a78180
htlcswitch/link: trim fix 2018-05-02 01:12:18 -07:00
Conner Fromknecht
ed4f77871a
htlcswitch/circuit_map: trim using NextLocalHtlcIndex 2018-05-02 01:12:17 -07:00