Commit Graph

5100 Commits

Author SHA1 Message Date
Wilmer Paulino
c1633da252
channeldb/graph_test: extend prune edge update index test to update edges
In this commit, we extend TestChannelEdgePruningUpdateIndexDeletion test
to include one more update for each edge. By doing this, we can
correctly determine whether old entries were properly pruned from the
index once a new update has arrived.
2018-09-04 18:33:41 -07:00
Wilmer Paulino
8dec659e10
channeldb/graph_test: properly check entries within edge update index
Due to entries within the edge update index having a nil value, the
tests need to be modified to account for this. Previously, we'd assume
that if we were unable to retrieve a value for a certain key that the
entry was non-existent, which is why the improper pruning bug was not
caught. Instead, we'll assert the number of entries to be the expected
value and populate a lookup map to determine whether the correct entries
exist within it.
2018-09-04 18:33:40 -07:00
Wilmer Paulino
2f22e6c35f
channeldb/graph: properly determine old update timestamp for an edge
In this commit, we fix a lingering issue within the edge update index
where entries were not being properly pruned due to an incorrect
calculation of the offset of an edge's last update time. Since the
offset is being determined from the end to the start, we need to
subtract all the fields after an edge policy's last update time from the
total amount of bytes of the serialized edge policy to determine the
correct offset. This was also slightly off as the edge policy included
an extra byte, which has been fixed in the previous commit.

Instead of continuing the slicing approach however, we'll switch to
deserializing the raw bytes of an edge's policy to ensure this doesn't
happen in the future when/if the serialization methods change or extra
data is included.
2018-09-04 18:33:38 -07:00
Wilmer Paulino
492d581df6
channeldb/graph: fix off-by-one public key slice
In this commit, we fix an off-by-one error when slicing the public key
from the serialized node info byte slice. This would cause us to write
an extra byte to all edge policies. Even though the values were read
correctly, when attempting to calculate the offset of an edge's update
time going backwards, we'd always be incorrect, causing us to not
properly prune the edge update index.
2018-09-04 18:31:38 -07:00
Wilmer Paulino
06344da62e
channeldb/graph: refactor UpdateEdgePolicy to use existing db transaction 2018-09-04 18:31:37 -07:00
Wilmer Paulino
aa3e2b6ba4
channeldb/graph: identify edge chan id on failure 2018-09-04 18:31:36 -07:00
Olaoluwa Osuntokun
12aadd4978
Merge pull request #1837 from Roasbeef/btcsuite-dep-catchup-5
build: update to latest versions of neutrino+btcwallet
2018-09-04 15:36:25 -07:00
Olaoluwa Osuntokun
4f43c1c943
Merge pull request #1811 from Roasbeef/autopilot-cpu-usage-fix
autopilot: modify the graph interface to return raw bytes for node pubkeys, not entire key
2018-09-03 19:56:51 -07:00
Olaoluwa Osuntokun
6aebd053a3
Merge pull request #1823 from cfromknecht/dont-dc-on-link-fail
peer: ensure link failures are processed in peer life cycle
2018-09-03 19:56:19 -07:00
Olaoluwa Osuntokun
450cabf0d8
Merge pull request #1822 from Roasbeef/chan-update-compat
lnwire: add new compatibility parsing more for onion error chan updates
2018-09-03 19:24:40 -07:00
Olaoluwa Osuntokun
8d02d74e0f
Merge pull request #1810 from wpaulino/switch-no-links-found
htlcswitch+server: avoid logging error if no links are found within peerTerminationWatcher
2018-09-03 19:18:33 -07:00
Olaoluwa Osuntokun
99a5fd9672
Merge pull request #1809 from wpaulino/autopilot-balance-update
autopilot/agent: use updateBalance rather than tracking balance explicitly
2018-09-03 19:18:03 -07:00
Olaoluwa Osuntokun
32b0f3ff95
Merge pull request #1770 from cfromknecht/prevent-goroutine-fail
lnd_test: Prevent calling Fatal in goroutine
2018-09-03 19:17:00 -07:00
Olaoluwa Osuntokun
07247720d4
build: update to latest versions of neutrino+btcwallet
In this commit, we update to the latest versions of btcwallet+neutrino
that fix a number of bugs within lnd itself. Namely, we ensure that we
no longer print out garbage bytes, properly reconnect btcd after being
disconnected, ensure we don't add duplicate utxos, and finally ensure
that we always start the rescan from the wallet's initial birthday.

Fixes #1775.
Fixes #1494.
Fixes #444.
2018-09-03 18:24:00 -07:00
Olaoluwa Osuntokun
edf304ad8b
peer: ensure we unlock the msgCond during peer msgConsumer exit 2018-09-03 17:03:05 -07:00
Olaoluwa Osuntokun
2b448be048
Merge pull request #1812 from cfromknecht/wait-predicate-pending-channels
lnd_test: add wait predicates to pending channel checks
2018-08-31 19:58:39 -07:00
Conner Fromknecht
95a98d86f6
lnd_test: add wait predicates to pending channel checks 2018-08-31 18:34:33 -07:00
Olaoluwa Osuntokun
31e92c4ff2
lnwire: add new compatibility parsing more for onion error chan updates
In this commit, we add a compatibility mode for older version of
clightning to ensure that we're able to properly parse all their channel
updates. An older version of c-lightning would send out encapsulated
onion error message with an additional type byte. This would throw off
our parsing as we didn't expect the type byte, and so we always 2 bytes
off. In order to ensure that we're able to parse these messages and make
adjustments to our path finding, we'll first check to see if the type
byte is there, if so, then we'll snip off two bytes from the front and
continue with parsing. if the bytes aren't found, then we can proceed as
normal and parse the request.
2018-08-31 17:24:26 -07:00
Conner Fromknecht
c569c40cef
lnd_test: prevent calling Fatal in goroutine
This commit prevents an error that I've seen on travis,
wherein the test fails because a call to Fatal happens
after the test finishes. The root cause is that we call
Fatal in a goroutine that is reading from the subscribe
graph rpc call.

To fix this, we now pass an err chan back into the main
test context, where we can receive any errors and fail
the test if one comes through.
2018-08-31 17:11:17 -07:00
Conner Fromknecht
48dc38d9f9
peer: ensure link failures are processed in peer life cycle 2018-08-30 17:36:13 -07:00
Olaoluwa Osuntokun
8f843c5eaa
discovery: update autopilot.Node usage to match recent API changes 2018-08-29 15:45:39 -07:00
Olaoluwa Osuntokun
a429c56c10
autopilot: update the Node interface to return a raw bytes, not the key
In this commit, we modify the Node interface to return a set of raw
bytes, rather than the full pubkey struct. We do this as within the
package, commonly we only require the pubkey bytes for fingerprinting
purposes. Before this commit, we were forced to _always_ decompress the
pubkey which can be expensive done thousands of times a second.
2018-08-29 15:44:47 -07:00
Wilmer Paulino
0a2986355e
pilot: improve error when unable to reach any of a peer's addresses 2018-08-29 02:06:03 -07:00
Wilmer Paulino
e1a4657427
pilot: remove disconnection logic from chanController
In this commit, we remove the disconnection logic within the
chanController when failing to open a channel with a peer. We do this as
it's already done within the autopilot agent, where it should be, and
because it's possible that we were already connected to this node and we
happened to disconnect them anyway.
2018-08-29 02:06:02 -07:00
Wilmer Paulino
e1a376d9f8
autopilot: use updateBalance rather than tracking balance explicitly
In this commit, we modify the balanceUpdate autopilot signal to update
the balance according to what's returned to the WalletBalance callback
rather than explicitly tracking the balance. This gives the agent a
better sense of what the wallet's balance actually is.
2018-08-29 02:06:02 -07:00
Wilmer Paulino
16b412fb51
server: avoid logging error if no links are found
In this commit, we avoid logging an error when the links associated with
a peer are not found within its termination watcher. We do this to
prevent a benign log message as the links have already been removed from
the switch.
2018-08-28 20:34:19 -07:00
Wilmer Paulino
33dda07b62
htlcswitch: return concrete error from GetLinksByInterface 2018-08-28 20:34:18 -07:00
Xavi Soler
2f1b024679 lnrpc: change lightning-api repo link redirect 2018-08-28 17:11:49 -07:00
Olaoluwa Osuntokun
a1f549754b
Merge pull request #1798 from wpaulino/premature-chan-ann-fetch
discovery/gossiper: remove optimistic channel announcement request
2018-08-27 17:13:27 -07:00
Wilmer Paulino
a1b1b06b9e
discovery/gossiper: remove optimistic channel announcement request
In this commit, we aim to resolve an issue with nodes requesting for
channel announcements when receiving a channel update for a channel
they're not aware of. This can happen if a node is not caught up with
the chain or if they receive updates for zombie channels. This would
lead to a spam issue, as if a node is not caught up with the chain,
every new update they receive is premature, causing them to manually
request the backing channel announcement. Ideally, we should be able to
detect this as a potential DoS vector and ban the node responsible, but
for now we'll simply remove this functionality.
2018-08-27 15:54:21 -07:00
Olaoluwa Osuntokun
73af09a06a
lnd+cmd/lncli: bump version to 0.5-beta 2018-08-27 14:23:53 -07:00
Olaoluwa Osuntokun
f1256ba41b
Merge pull request #1788 from cfromknecht/disable-height-hint-cache
Disable height hint cache
2018-08-27 11:19:40 -07:00
Olaoluwa Osuntokun
28a59362d6
peer: ensure readHandler doesn't block on AddMsg to msgStream
In this commit, we add a quit channel to the AddMsg method of the
msgStream struct. Before this commit, if the queue was full, the
readHandler would block and be unable to exit. We remedy this by
leveraging the existing quit channel of the peer as an additional select
case within the AddMsg method.
2018-08-26 20:02:50 -07:00
Conner Fromknecht
a5b9279ca1
lnd_test: correct force close test re: htlc limbo funds
This commit fixes a bug in the integration test, that
reliably fails after disabling the height hint cache.
The test originally asserted that the htlc funds were
in limbo, but was reading a stale copy of the force
close information. Recently, the test was amended to
provided a valid read of the force close in
96a079873a6da2f0a93adc30945971fc07c5e610. However,
the issue was not apparent until build against the
disabled height hint cache.

The test is now correct to assert that there are no
funds in limbo, as the commitment output has been
swept, but the htlcs are still in the contract
court, so the nursery is unaware of them. We also
add another sanity check to validate that there are
no pending htlcs on the force close at that point
in time.
2018-08-26 19:55:38 -07:00
Conner Fromknecht
98e7c968d4
chainntnfs/btcdnotify: disable height hint cache in testing 2018-08-26 15:34:20 -07:00
Conner Fromknecht
ab28db5b0d
chainntnfs/bitcoindnotify: disable height hints in testing 2018-08-26 15:34:05 -07:00
Conner Fromknecht
0e29a457e1
chainregistry: disable height hint cache 2018-08-26 15:32:10 -07:00
Conner Fromknecht
70ba3119b7
lnwallet/interface_test: run tests with disabled hint cache 2018-08-26 15:32:10 -07:00
Conner Fromknecht
12761a4f43
chainntnfs/interface_test: run tests w/ disabled cache 2018-08-26 15:32:10 -07:00
Conner Fromknecht
45a2c9aca8
chainntnfs/height_hint_cache_test: add tests for disabled cache 2018-08-26 15:32:09 -07:00
Conner Fromknecht
7df9ae0266
chainntnfs/height_hint_cache: add disable flag to hint cache 2018-08-26 15:32:06 -07:00
Olaoluwa Osuntokun
26f68da5b2
Merge pull request #1785 from Roasbeef/ensure-peer-quit
peer+server: ensure the peer is always able to quit even mid msgStream application
2018-08-25 18:24:12 -07:00
Olaoluwa Osuntokun
f2db18733b
peer: before and after obtaining link for chan update, check quit signal 2018-08-25 17:30:17 -07:00
Olaoluwa Osuntokun
13a6d413ac
discovery: select on peer's QuitSignal to allow caller to unblock if disconnecting
In this commit, we select on the peer's QuitSignal to allow the caller
to unblock if the peer itself is disconnecting. With this change, we now
ensure that it isn't possible for a peer to block on this method and
prevent a graceful exit.
2018-08-25 17:30:16 -07:00
Olaoluwa Osuntokun
19552b0dbf
htlcswitch+funding+discovery: update mock peers to add new QuitSignal method 2018-08-25 17:30:15 -07:00
Olaoluwa Osuntokun
7f480f723c
peer: add QuitSignal to ensure peer struct adheres to lnpeer.Peer interface 2018-08-25 17:30:14 -07:00
Olaoluwa Osuntokun
1364dca5a6
lnpeer: extend Peer interface with new QuitSignal method
In this commit, we extend the Peer interface with a new QuitSignal
method. This method is meant to expose a read-only quit channel which
will allow callers to cancel any actions based on the lifetime of the
underlying peer.
2018-08-25 17:30:13 -07:00
Olaoluwa Osuntokun
169cb723ce
build: update dep for golang.org/x/crypto to compile under golang 1.11 2018-08-25 17:30:12 -07:00
Olaoluwa Osuntokun
0e510c8b5c
funding+peer: don't attempt to deliver messages if the peer is shutting down 2018-08-25 17:30:11 -07:00
Olaoluwa Osuntokun
d6f534cfa5
peer: don't attempt to re-enable any private channels 2018-08-25 17:30:09 -07:00