Commit Graph

1953 Commits

Author SHA1 Message Date
Alex
5d971a8ea8 lncli: add support for macaroons 2017-08-17 19:20:41 -07:00
Alex
922b065de5 main: integrate macaroons into config, startup, and RPC server 2017-08-17 19:20:41 -07:00
Alex
662731e719 macaroons: add macaroons package and update glide 2017-08-17 19:20:41 -07:00
Olaoluwa Osuntokun
5ef077e5c8
routing: cap number of yen's algorithm iterations at 100
This commit makes a precautionary change in order to ensure that the
upper bound on the number of iteration’s within our version of Yen’s
algorithm is fixed.
2017-08-15 19:56:41 -07:00
Olaoluwa Osuntokun
09521b9c2a
autopilot: fix linter error 2017-08-15 18:26:59 -07:00
Olaoluwa Osuntokun
711b695a2f
autopilot: add tracking of pending channel state
This commit adds tracking of the pending channels state within the
autopilot.Agent. This fixes a class of bugs which was discovered during
the latest test net block storm wherein the Agent would attempt to
repeatedly attach to the same node due to rapid closure of other
channels.

In this commit we fix this issue by ensuring that we always factor in
the pending channel state when querying the heuristic w.r.t if we need
more channels, and if so to which nodes should be attached to.
2017-08-15 18:23:58 -07:00
Olaoluwa Osuntokun
8034780ca4
autopilot: fix chanID collision test flake by instead using atomic counter
This commit fixes a prior occasional test flake caused by the collision
of the randomly selected 64-bit integers. In order to get around this,
we now instead have a atomic monotonically increasing counter for each
channel ID used within the tests.
2017-08-15 17:56:24 -07:00
Olaoluwa Osuntokun
572eef2840
htlcswitch: add channel point prefix to HTLC examine logs 2017-08-15 17:55:06 -07:00
Olaoluwa Osuntokun
f458dc26ed
lnwallet: correct godoc comments on script util helper functions
The godoc comments for htlcSpendRevoke and htlcSpendSuccess were
incorrect.
2017-08-15 17:53:45 -07:00
Olaoluwa Osuntokun
c4e43dbaa2
server: avoid nil pointer deference within OutboundPeerConnected 2017-08-15 17:49:35 -07:00
sam
06ff0a0192 BOLT's -> BOLTs 2017-08-14 17:53:52 -07:00
Max Fang
b88438d708 lnrpc: Add descriptions and lncli mappings to rpc.proto 2017-08-14 17:53:19 -07:00
Max Fang
9cd1168ebe docs: State example gRPC assumptions, add TLS grpc instructions 2017-08-14 17:51:41 -07:00
Max Fang
96a5fdd3ec Remove characters from docker guide that break utf-8 encoding 2017-08-14 17:51:41 -07:00
Max Fang
ab97fa7287 docs: Javascript gRPC streaming examples & complete guide 2017-08-14 17:51:41 -07:00
Max Fang
34d270398f docs: Make Python gRPC docs suitable as an independent guide 2017-08-14 17:51:41 -07:00
Max Fang
9f8378f4cf readme+docs: Consolidate installation docs 2017-08-14 17:51:41 -07:00
Olaoluwa Osuntokun
06782ebdb3 Merge pull request #225 from halseth/channel-close-negotiation2
Add fee negotiation on channel cooperative shutdown.
2017-08-14 17:48:05 -07:00
Alex
58c6989e74 tests: fix several timeout issues 2017-08-14 17:02:31 -07:00
Johan T. Halseth
e8e87322dd
peer: add channel close fee negotiation
This commit adds the fee negotiation procedure performed
on channel shutdown. The current algorithm picks an ideal
a fee based on the FeeEstimator and commit weigth, then
accepts the remote's fee if it is at most 50%-200% away
from the ideal. The fee negotiation procedure is similar
both as sender and receiver of the initial shutdown
message, and this commit also make both sides use the
same code path for handling these messages.
2017-08-11 12:10:32 +02:00
Johan T. Halseth
b9516b7cdd
lnwallet: make CreateCloseProposal take absolute fee instead of fee rate 2017-08-11 12:09:39 +02:00
Olaoluwa Osuntokun
48be9261ef
autopilot: fix linter error 2017-08-10 22:07:22 -07:00
Olaoluwa Osuntokun
143e7bdf5f
test: ensure nodes spun up by test framework use fresh config files
This commit modifies the way the nodes spun up the by test framework
are created such that they don’t use the configuration parameters
storage in the normal lnd home directory. Otherwise, tests would pick
up the configuration of the user’s pre-existing lnd nodes.
2017-08-10 22:00:53 -07:00
Olaoluwa Osuntokun
c02710c8c9
test: add +build !rpctest to tests files in main package
This commit adds the +build !rpctest build flag to the test files in
the main package other than the RPC tests. With this, if the protest
build flag is set, then ONLY those tests will be run.
2017-08-10 21:59:23 -07:00
Olaoluwa Osuntokun
512a5c899b
rpc: only set balance params when force closing if output not dust
This commit fixes an existing bug that would cause a force closed
channel to stay pending forever. In this instance, if one force closes
a channel while they have a dust output, and restart before the channel
is fully closed, then it wouldn’t have been closed automatically
(within the database) by the autopilot agent.
2017-08-10 21:43:17 -07:00
Olaoluwa Osuntokun
ece1d09a9f
lnd: initialize an autopilot.Agent instance if set in the config file 2017-08-10 21:40:16 -07:00
Olaoluwa Osuntokun
ba5ed9e8d2
log: add logger for the autopilot package 2017-08-10 21:39:47 -07:00
Olaoluwa Osuntokun
8dd4245d43
pilot: implement necessary interfaces to drive an autopilot.Agent
This commit adds a new file to the repo: pilot.go. This files contains
the items necessary to configure, and initialize an instance of
autopilot.Agent with the passed configuration struct.
2017-08-10 21:39:11 -07:00
Olaoluwa Osuntokun
629793a249
config: add configuration options for autopilot mode 2017-08-10 21:26:52 -07:00
Olaoluwa Osuntokun
472d9967e5
server: fix some minor style deviations in new server code 2017-08-10 21:20:54 -07:00
Olaoluwa Osuntokun
bee7ed7758
server: re-introduce the quit channel to the server
This commit re-introduces the quit channel to the server as an upcoming
addition needs to synchronize its shutdown with the lifetime of the
server.
2017-08-10 21:19:00 -07:00
Olaoluwa Osuntokun
947544753f
server: use %x (hex encoding) when logging peer's pub key 2017-08-10 21:17:07 -07:00
Olaoluwa Osuntokun
e10388fc53
funding: increase timeout for TestFundingManagerRestartBehavior test 2017-08-10 21:16:10 -07:00
Olaoluwa Osuntokun
8abba7eafc
channeldb: add TODO to add storage for onion adds 2017-08-10 21:15:55 -07:00
Olaoluwa Osuntokun
671f15383b
chainntnfs: fix a typo 2017-08-10 21:15:38 -07:00
Olaoluwa Osuntokun
306c4aef8e
autopilot: "Look ma no hands!", introducing autopilot mode
This commit introduces the initial implementation of the autopilot
mode. Autopilot is new mode within lnd that enables automatic channel
management. This means that if enabled lnd will attempt to
automatically manage channels according to a set of heuristic defined
within the main configuration for autopilot.Agent instance.

The autopilot.Agent implements a simple closed control loop. It takes
in external signals such as wallet balance updates, new open channel,
and channels that are now closed the updates its internal state. With
each external trigger it will consult the registered
AttachmentHeuristic to decide: if it needs to open any more channels,
and if so how much it should use to open the channels, ultimately
returning a set of recommended AttachmentDirectives. The
autopilot.Agent loop will then take those attempt to establish
connection, and go back in waiting for a new external signal.

With this first implementation the default heuristic is the
ConstrainedPrefAttachment implementation of AttachmentHeuristic. Given
a min and max channel size, a limit on the number of channels, and the
percentage of wallet funds to allocate to channels, it will attempt to
execute a heuristic drive by the Barabási–Albert model model in order
to attempt to drive the global graph towards a scale free topology.

This is commit implements a foundational layer for future simulations,
optimization, and additional heuristics.
2017-08-10 21:14:55 -07:00
Olaoluwa Osuntokun
a2545d85dc
peer: ensure goroutine launched during initial handshake exits
This commit fixes a bug which was covered by the recent server
refactoring wherein the grouting would be stuck on the send over the
message channel in the case that the handshake failed. This blockage
would create a deadlock now that the ConnectToPeer method is full
synchronous.

We fix this issue by ensuring the goroutine properly exits.
2017-08-10 18:07:54 -07:00
Conner Fromknecht
84a0806da4 lnd_test: allow assertNumConnections to exit early 2017-08-10 16:14:01 -07:00
Conner Fromknecht
8930b4e481 htlcswitch: sync mock server shutdown of switch 2017-08-10 16:14:01 -07:00
Conner Fromknecht
13b78fea1f rpcserver: lookup num pending channels from chanDB 2017-08-10 16:14:01 -07:00
Conner Fromknecht
39344b6445 fundingmanager: removes NumPendingChannels 2017-08-10 16:14:01 -07:00
Conner Fromknecht
d3dc546108 lnd+rpcserver: use new public server API 2017-08-10 16:14:01 -07:00
Conner Fromknecht
56a628d3ad lnd_test: adds polling to assertNumConnections 2017-08-10 16:14:01 -07:00
Conner Fromknecht
efd9cf12b8 peer: adds tracking of go routines to sync disconnect
In addition to improved synchronization between the client
  and server, this commit also moves the channel snapshotting
  procedure such that it is handled without submitting a query
  to the primary select statement. This is primarily done as a
  precaution to ensure that no deadlocks occur, has channel
  snapshotting has the potential to block restarts.
2017-08-10 16:14:01 -07:00
Conner Fromknecht
91d6b0492e server: refactors w/ single mutex and sync disconnect
This commit alters the synchronization patterns used in the server
  such that the internal state is protected by a single mutex.  Overall,
  this simplifies the ability to reason about the behavior and
  manipulation of the internal state, which has resolved a few of flakes
  related to race conditions that were observed before hand.

  Invoking DisconnectPeer is now fully synchronous, and waits until
  the provided peer's peerTerminationWatcher has exited before
  returning.  Currently this is done by tracking the watcher using the
  peer's WaitGroup, and locking until the peer has shutdown.

  The server's API has also been refactored such that all public methods
  are safe for concurrent use. Therefore, other subsystems should be
  sure to make use of these endpoints to avoid corrupting the internal
  state.
2017-08-10 16:14:01 -07:00
Johan T. Halseth
80a8cc0add rpcserver: fix method name typo in godoc 2017-08-10 13:14:25 -07:00
Johan T. Halseth
849d0b93b1 fundingManager: persist state in opening process.
Persists the state of a channel opening process after funding
transaction is confirmed. This tracks the messages sent to
the peer such that the process can be continued in case of a
restart. Also introduces that the receiver side forgets about
channel if funding transaction is not confirmed in 48hrs.
2017-08-10 13:14:25 -07:00
Johan T. Halseth
6858b1e1b2 integration tests: add sleep before opening second channel.
In the "multiple channel creation" test, in some cases the
responder (Bob) was not yet considering the first channel
to be opened (activeReservation still not deleted in
fundingManager) when Alice tried to open the second channel.
This would cause the test to fail. This commit adds a small
sleep before the creation of the second channel, to give
Bob some time to finish the opening process.
2017-08-10 13:14:25 -07:00
Johan T. Halseth
5c89ec6288 fundingManager: let CurrentNodeAnnouncement return copy instead of ref 2017-08-08 12:29:27 -07:00
Johan T. Halseth
c497a63f14 server: return copy of current node announcement instead of ref 2017-08-08 12:29:27 -07:00