Commit Graph

4208 Commits

Author SHA1 Message Date
Wilmer Paulino
978fc7ba08
config+lnd: update tor config to include onion services flags
In this commit, we update the set of Tor flags to use sane defaults when
not specified. We also include some new flags related to the recent
onion services changes. This allows users to easily get set up on Tor by
only specifying the tor.active flag. If needed, the defaults can still
be overridden.
2018-06-04 20:41:40 -07:00
Wilmer Paulino
d6c2957f3c
tor: add inital tor controller implementation
In this commit, we add our inital implementation of a Tor Controller.
This commit includes the ability for the controller to automatically
signal the Tor daemon to create a v2 onion service. This will be
expanded later on to support creating v3 onion services.

Before allowing the controller to interact with the Tor daemon, the
connection must be authenticated first. This commit includes support for
the SAFECOOKIE authentication method as a sane default.

Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:36 -07:00
Wilmer Paulino
5d29dea21a
tor: return the connection's actual remote address rather than the proxy's
In this commit, we fix an issue where connections made through Tor's
SOCKS proxy would result in the remote address being the address of the
proxy itself

We fix this by using an internal proxyConn struct that sets the correct
address at the time of the connection.
2018-06-04 20:41:35 -07:00
Wilmer Paulino
5f1d2524b8
channeldb: add address serialization tests 2018-06-04 20:41:34 -07:00
Wilmer Paulino
3738e68ae2
channeldb: implement serialization of onion addresses
Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:33 -07:00
Wilmer Paulino
e5987a1ef1
lnwire: extend tests to randomly generate all types of supported addresses 2018-06-04 20:41:32 -07:00
Wilmer Paulino
850f9fbbe9
lnwire: implement serialization of onion addresses
Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:31 -07:00
Wilmer Paulino
a07397465b
tor: add onion address implementation
Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:30 -07:00
Wilmer Paulino
eded682f9b
build: update inputs-digest due to removed btcsuite/go-socks dep 2018-06-04 20:41:29 -07:00
Wilmer Paulino
43cbd5a814
tor: streamline package to better follow the Effective Go guidelines
In this commit, we clean up the tor package to better follow the
Effective Go guidelines. Most of the changes revolve around naming,
where we'd have things like `torsvc.TorDial`. This was simplified to
`tor.Dial` along with many others.
2018-06-04 20:41:28 -07:00
Olaoluwa Osuntokun
3bc026aece
Merge pull request #1319 from halseth/chain-height-resend-commitsig
[bugfix] lnwallet/channel: use FullySynced to check chanSync special case
2018-06-04 17:06:34 -07:00
Rudy Godoy
3ee4f5fbd4 docs/docker: fixed link to /docker/README.md
Link must be /docker/README.md, relative to the repository's root. Previously it was relative to /docs, resulting in 404.
2018-06-04 16:13:17 -07:00
Johan T. Halseth
07629e5da1
lnwallet/channel: use FullySynced to check chanSync special case
We check if the channel is FullySynced instead of comparing the local
and remote commit chain heights, as the heights might not be in sync.
Instead we call FullySynced which recently was modified to use compare
the message indexes instead, which is _should_ really be in sync between
the chains.

The test TestChanSyncOweRevocationAndCommitForceTransition is altered to
ensure the two chains at different heights before the test is started, to
trigger the case that would previously fail to resend the commitment
signature.
2018-06-04 15:09:51 +02:00
Olaoluwa Osuntokun
2fa2644aec
Merge pull request #618 from wpaulino/change-wallet-password
Change wallet password
2018-06-01 17:49:40 -07:00
Olaoluwa Osuntokun
7e4abb4f55
Merge pull request #1301 from halseth/fundingmanager-double-error
Reduce fundingmanager chan send deadlock scenarios
2018-06-01 17:36:02 -07:00
Olaoluwa Osuntokun
b43fc2f42f
Merge pull request #1209 from halseth/makefile-fixes
[Makefile] Remove logs between runs, print date
2018-06-01 17:33:52 -07:00
Olaoluwa Osuntokun
a1ad3a5011
Merge pull request #1309 from cfromknecht/prevent-decayedlog-db-reuse
htlcswitch/decayedlog_test: create unique test dbs
2018-06-01 13:09:37 -07:00
Johan T. Halseth
cdaafc4a23
fundingmanager: hold mutex during ctx cancellation
This commit changes cancelReservationCtx to gold the resMtx from start
to finish. Earlier it would lock at different times only when accessing
the maps, meaning that other goroutines (I'm looking at you
PeerTerminationWatcher) could come in and grab the context in between
locks, possibly leading to a race.
2018-06-01 09:19:01 +02:00
Johan T. Halseth
3d964628f0
fundingmanager test: check that error is sent on timeout 2018-06-01 08:55:07 +02:00
Johan T. Halseth
d20cb8e2f6
fundingmanager: send on resCtx.err in failFundingFlow
This commit moves the responsibility of sending a funding error on the
reservation error channel inside failFundingFlow, reducing the places we
need to keep track of sending it.
2018-06-01 08:55:07 +02:00
Johan T. Halseth
9090344329
fundingmanager: simplify handleErrorMsg 2018-06-01 08:55:07 +02:00
Johan T. Halseth
7d38e35cdc
fundingmanager: send error directly in CancelPeerReservations
The error channel should never be nil, and it should always be buffered.
Because of this we can send directly on the channel.
2018-06-01 08:55:07 +02:00
Johan T. Halseth
b63ee1a410
fundingmanager: fail funding flow on confirmation timeout 2018-06-01 08:55:07 +02:00
Johan T. Halseth
ccf9cd47ef
fundingmanager: delete empty peer in deleteReservationCtx 2018-06-01 08:55:06 +02:00
Johan T. Halseth
6ee58ec1b0
fundingmanager: don't block on pendingChannels chan send 2018-06-01 08:55:06 +02:00
Johan T. Halseth
08d9edd059
server: increase updateChan buffer to 2 2018-06-01 08:55:06 +02:00
Johan T. Halseth
5ddb154a45
fundingmanager: use non-zero channel ID 2018-06-01 08:55:06 +02:00
Olaoluwa Osuntokun
da72f8aa6a
Merge pull request #1106 from Roasbeef/new-graph-sync
multi: implement new query based channel graph synchronization
2018-05-31 20:08:15 -07:00
Olaoluwa Osuntokun
b3ac3492a0
discovery: if unable to find gossipSyncer for peer, create one
In this commit we fix an existing bug caused by a scheduling race
condition. We'll now ensure that if we get a gossip message from a peer
before we create an instance for it, then we create one on the spot so
we can service the message. Before this commit, we would drop the first
message, and therefore never sync up with the peer at all, causing them
to miss channel announcements.
2018-05-31 17:54:45 -07:00
Wilmer Paulino
4e2ae89219
cmd/lncli: add changepassword command 2018-05-31 17:24:01 -07:00
Wilmer Paulino
58a3419283
lnd+walletunlocker: implement ChangePassword RPC 2018-05-31 17:24:00 -07:00
Wilmer Paulino
fc6505a0ff
macaroons: export db filename 2018-05-31 17:23:59 -07:00
Wilmer Paulino
1a47d182d3
lnd+lnwallet: extract default wallet password vars into lnwallet 2018-05-31 17:23:58 -07:00
Wilmer Paulino
b32e0ced45
lnd+walletunlocker: remove macaroon dependency from UnlockerService 2018-05-31 17:23:57 -07:00
Wilmer Paulino
e73b457e1f
lnrpc: add new ChangePassword RPC to WalletUnlocker 2018-05-31 17:23:56 -07:00
Olaoluwa Osuntokun
994d9cf7e4
discovery: attempt to request the full chan ann for stray chan updates
In this commit, we extend the AuthenticatedGossiper to take advantage of
the new query features in the case that it gets a channel update w/o
first receiving the full channel announcement. If this happens, we'll
attempt to find a syncer that's fully synced, and request the channel
announcement from it.
2018-05-31 16:31:01 -07:00
Olaoluwa Osuntokun
6a6700e629
discovery: add new SyncState method to gossipSyncer
This new method allows outside callers to sample the current state of
the gossipSyncer in a concurrent-safe manner. In order to achieve this,
we now only modify the g.state variable atomically.
2018-05-31 16:31:00 -07:00
Olaoluwa Osuntokun
70dffe7e99
channeldb: ensure that when we delete a channel we delete entry in edge update index
In this commit, we ensure that all indexes for a particular channel have
any relevant keys deleted once a channel is removed from the database.
Before this commit, if we pruned a channel due to closing, then its
entry in the channel update index would ever be removed.
2018-05-31 16:30:59 -07:00
Olaoluwa Osuntokun
55dfc17c05
discovery: de-duplicate node announcements with legacy chan graph sync
Fixes #1072.
2018-05-31 16:30:58 -07:00
Olaoluwa Osuntokun
41e1a7b056
config: add new command line option to disable chan update all together
In this commit, we add a new command line option to allow (ideally
routing nodes) to disable receiving up-to-date channel updates all
together. This may be desired as it'll allow routing nodes to save on
bandwidth as they don't need the channel updates to passively forward
HTLCs. In the scenario that they _do_ want to update their routing
policies, the first failed HTLC due to policy inconsistency will then
allow the routing node to propagate the new update to potential nodes
trying to route through it.
2018-05-31 16:30:58 -07:00
Olaoluwa Osuntokun
d7b21859d5
server: upon disconnect, prune peer query state from gossiper 2018-05-31 16:30:57 -07:00
Olaoluwa Osuntokun
199bbe2fd4
server: if remote peer knows of gossip queries, skip initial table dump 2018-05-31 16:30:57 -07:00
Olaoluwa Osuntokun
f70f1f318d
server: set the dataloss protect and gossip queries feature bits 2018-05-31 16:30:57 -07:00
Olaoluwa Osuntokun
486f87576c
server: instantiate the chanSeries struct in the gossiper's config 2018-05-31 16:30:56 -07:00
Olaoluwa Osuntokun
210e28a483
peer: add messages summaries for the new gossip query messages 2018-05-31 16:30:56 -07:00
Olaoluwa Osuntokun
40bb19eb6e
peer: dispath new gossip query messages to the gossiper 2018-05-31 16:30:55 -07:00
Olaoluwa Osuntokun
0016b3f458
discovery+lnd: create new chanSeries impl of the ChannelGraphTimeSeries interface
In this commit, we create a new concrete implementation for the new
discovery.ChannelGraphTimeSeries interface. We also export the
createChannelAnnouncement method to allow the chanSeries struct to
re-use the existing code for creating wire messages from the database
structs.
2018-05-31 16:30:55 -07:00
Olaoluwa Osuntokun
12e73f55e9
channeldb: add database migration for new node+edge update indexes
In this commit, we add a new database migration required to update old
database to the version of the database that tracks the update index for
the nodes and edge policies. The migration is straight forward, we
simply need to populate the new indexes for the all the nodes, and then
all the edges.
2018-05-31 16:30:54 -07:00
Olaoluwa Osuntokun
baed4d1f47
channeldb: add new methods required to implement new discovery.ChannelGraphTimeSeries interface
In this commit, we add a series of methods, and a new database index
that we'll use to implement the new discovery.ChannelGraphTimeSeries
interface interface. The primary change is that we now maintain two new
indexes tracking the last update time for each node, and the last update
time for each edge. These two indexes allow us to implement the
NodeUpdatesInHorizon and ChanUpdatesInHorizon methods. The remaining
methods added simply utilize the existing database indexes to allow us to
respond to any peer gossip range queries.

A set of new unit tests has been added to exercise the added logic.
2018-05-31 16:30:54 -07:00
Olaoluwa Osuntokun
45bd544f11
discovery: update AuthenticatedGossiper to be aware of new gossipSyncers
In this commit, we update the logic in the AuthenticatedGossiper to
ensure that can properly create, manage, and dispatch messages to any
gossipSyncer instances created by the server.

With this set of changes, the gossip now has complete knowledge of the
current set of peers we're conneted to that support the new range
queries. Upon initial connect, InitSyncState will be called by the
server if the new peer understands the set of gossip queries. This will
then create a new spot in the peerSyncers map for the new syncer. For
each new gossip query message, we'll then attempt to dispatch the
message directly to the gossip syncer. When the peer has disconnected,
we then expect the server to call the PruneSyncState method which will
allow us to free up the resources.

Finally, when we go to broadcast messages, we'll send the messages
directly to the peers that have gossipSyncer instances active, so they
can properly be filtered out. For those that don't we'll broadcast
directly, ensuring we skip *all* peers that have an active gossip
syncer.
2018-05-31 16:30:53 -07:00