Commit Graph

5001 Commits

Author SHA1 Message Date
Conner Fromknecht
93f1994dc5
pilot: signal OnNodeUpdates to autopilot 2018-08-23 18:58:12 -07:00
Conner Fromknecht
602856750b
autopilot/agent: add OnNodeUpdates signal
Adds a new external signal alerting autopilot that
new nodes have been added to the channel graph or
an existing node has modified its channel
announcment. This allows autopilot to examine its
current state, and attempt to open channels if our
target state is not yet met.
2018-08-23 18:58:12 -07:00
Olaoluwa Osuntokun
8de84c4576
Merge pull request #1754 from halseth/fndmgr-gossiper-handoff
Unify gossiper and router announcement handling
2018-08-23 18:44:37 -07:00
Olaoluwa Osuntokun
dadf13e2a3
cmd/lncli: rename parseArgs to extractPathArgs, return error 2018-08-23 18:05:24 -07:00
Olaoluwa Osuntokun
ebc9550a1b
cmd/lncli: properly parse cert and macaroon paths for all config variants
In this commit, we ensure that we're able to properly parse the cert and
macaroon paths for all relevant config variants. Before this commit, it
would be the case that the macaroon path ended up empty if a user wasn't
running the default (mainnet, lnddir) settings. In this commit, we
remedy this by parsing each of the two (cert+macaroon) paths
independently.
2018-08-23 18:05:23 -07:00
Olaoluwa Osuntokun
3d4843ed6c
docker: update docker README to account for recent lncli/macaroon changes 2018-08-23 18:05:23 -07:00
Olaoluwa Osuntokun
4d74fa32a9
config: update comment for network directory 2018-08-23 18:05:22 -07:00
Wilmer Paulino
dc3db4bf62 docs: update path to where macaroons are stored
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Wilmer Paulino
856500dc43 macaroons: ensure path for macaroon DB exists
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Wilmer Paulino
4ba6a59e75 cmd/lncli: retrieve the macaroon for the current chain and network
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Wilmer Paulino
56504d2685 cmd/lncli: add flags to determine the macaroon for the active network
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Wilmer Paulino
e1726ecb2f config: remove default macaroon path
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Wilmer Paulino
9981fd8fa7 config+lnd: create macaroons files under the network dir
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Wilmer Paulino
6ddae25487 config+cmd/lncli: make cleanAndExpandPath return empty string on empty path
Co-Authored-By: Karl Ranna <karl@karlranna.com>
2018-08-23 18:05:00 -07:00
Olaoluwa Osuntokun
646e81262f
Merge pull request #1771 from halseth/contractcourt-handoff-coop-trigger
[contractcourt] add coopCloseTrigger on startup for pendingClose channel
2018-08-23 16:19:55 -07:00
Johan T. Halseth
8344b05c38
contractcourt/chanarb test: expand TestChannelArbitratorCommitFailure to coop and local force close 2018-08-23 10:04:43 +02:00
Johan T. Halseth
4933120d38
contractcourt/channel arbitrator: add coopCloseTrigger on startup for pendingClose channel 2018-08-23 10:04:43 +02:00
Johan T. Halseth
6a6d3ff557
funding tests: account for returned err channel 2018-08-23 07:40:41 +02:00
Johan T. Halseth
67d36eb79d
funding: make SendAnnouncement return error chan instead of error 2018-08-23 07:40:41 +02:00
Johan T. Halseth
4b04e1afd1
routing: return ErrRejected if found in reject cache
We make sure to return an error other than ErrIgnored, as ErrIgnored is
expected to only be returned for updates where we already have the
necessary information in the database.

In case of a channel ID found in the rejectCache, there was a
possibility that we had rejected an invalid update for this channel
earlier, and when attempting to add the current update we wouldn't
distinguish the failure to add from an outdated/ignored update.
2018-08-23 07:40:40 +02:00
Johan T. Halseth
c56082006f
discovery/gossiper: formatting 2018-08-23 07:40:40 +02:00
Johan T. Halseth
0bc415c683
discovery/gossiper: don't return on errChan for ChannelUpdate not yet processed
Previosuly we would immediately return nil on the error channel for
premature ChannelUpdates, which would break the expection that a a
returned non-error meant the update was successfully added to the
database. This meant that the caller would believe the update was added
to the database, while it is actually still in volatile memory and can
be lost during restarts.

This change makes us handle premature ChannelUpdates as we handle other
premature announcements within the gossiper, by deferring sending on the
error channel until we have reprocessed the update.
2018-08-23 07:40:40 +02:00
Johan T. Halseth
7bbb2bbc80
discovery/gossiper: return on errChan on ValidationBarrier error 2018-08-23 07:40:40 +02:00
Johan T. Halseth
c8ce2aa2d2
discovery/gossiper: reaturn early of no premature to process 2018-08-23 07:40:39 +02:00
Johan T. Halseth
d0e8aeece1
discovery/gossiper: return on errChan in case of ChanAnn/Upd on wrong chain
Previously we wouldn't return anything in the case where the
announcement were meant for a chain we didn't recognize. After this
change we should return an error on the error channel in all flows
within the gossiper.
2018-08-23 07:40:39 +02:00
Johan T. Halseth
54f67f72b1
discovery/gossiper: define ErrGossiperShuttingDown 2018-08-23 07:40:39 +02:00
Johan T. Halseth
18e680f192
router: simplify edge outdated logic, return ErrOutdated if old. 2018-08-23 07:40:39 +02:00
Olaoluwa Osuntokun
47788c3cec
Merge pull request #1696 from halseth/contractcourt-handoff3
contractcourt handoff 2
2018-08-22 21:41:50 -07:00
Olaoluwa Osuntokun
4f20905ac1
Merge pull request #1719 from cfromknecht/duplicate-payments
Control Tower: Sender-side checks for duplicate payments #2
2018-08-22 21:22:38 -07:00
Olaoluwa Osuntokun
c9bead7c21
Merge pull request #1278 from wpaulino/persistent-chain-notifiers
chainntnfs: introduce persistent height hint layer to ChainNotifier implementations
2018-08-22 21:02:27 -07:00
Johan T. Halseth
bb71856204
contractcourt/channel_arbitrator test: add TestChannelArbitratorEmptyResolutions 2018-08-23 00:03:22 +02:00
Johan T. Halseth
ed5db96e05
contractcourt/channel_arbittrator: ignore noResolutions error on startup 2018-08-23 00:03:22 +02:00
Johan T. Halseth
b031d87daf
contractcourt/briefcase: test FetchContractResolutions error when no resolutions logged 2018-08-23 00:03:22 +02:00
Johan T. Halseth
53286b8cee
contractcourt test: add TestChannelArbitratorCommitFailure 2018-08-23 00:03:22 +02:00
Johan T. Halseth
f2a033e965
contractcourt/channel_arbitrator: override trigger on startup if IsClosing
At ChannelArbitrator startup we now check the database close status of
the channel. If we detect that the channel is closed, but our state
machine hasn't advanced to reflect that (possibly because of a shutdown
before the state transition was finished), we manually trigger the state
transition to recover.
2018-08-23 00:03:22 +02:00
Johan T. Halseth
1758ad829f
contractcourt/[chain|channel]_arbitrator: define IsPendingClose 2018-08-23 00:03:22 +02:00
Johan T. Halseth
6b24ca0387
contractcourt test: add TestChannelArbitratorPeristence 2018-08-23 00:03:21 +02:00
Johan T. Halseth
75df58c68b
contractcourt: move responsibility for closing force closes to chanArb
This commit moves the responsibility for closing local and remote force
closes in the database from the chain watcher to the channel arbitrator.

We do this because we previously would close the channel in the
database, before sending the event to the channel arbitrator. This could
lead to a situation where the channel was marked closed, but the channel
arbitrator didn't receive the event before shutdown. As we don't listen
for chain events for channels that are closed, those channels would be
stuck in the pending close state forever, as the channel arbitrator
state machine wouldn't progress.

We fix this by letting the ChannelArbitrator close the channel in the
database. After the contract resolutions are logged (in the state
callback before transitioning to StateContractClosed) we mark the
channel closed in the database. This way we make sure that it is marked
closed only if the resolutions have been successfully persisted.
2018-08-23 00:03:21 +02:00
Johan T. Halseth
c11e0940c2
contractcourt/channel_arbitrator test: test new coop close actions 2018-08-23 00:03:21 +02:00
Johan T. Halseth
ad1d78884a
contractcourt: move responsibility for closing coop close channel to chanArb 2018-08-23 00:03:21 +02:00
Johan T. Halseth
3549f2bc17
contractcourt/[channel|chain]_arbitrator: define MarkChannelClosed 2018-08-22 23:51:04 +02:00
Johan T. Halseth
740db4716f
contractcourt/channel_arbitrator test: test state transitions 2018-08-22 23:51:04 +02:00
Johan T. Halseth
862c7ae223
contractcourt/channel_arbitrator test: check both respChan and errChan
// Both are sent on, so in some cases we would read from errChan first,
making the test fail.
2018-08-22 23:51:04 +02:00
Johan T. Halseth
06c683d48d
contractcourt/channel_arbitrator: move next state commit out of stateStep 2018-08-22 23:51:04 +02:00
Johan T. Halseth
6df302d7f5
contractcourt/channel_arbitrator: remove state callback
This commit removes the state callback, and instead logs the contract
resolutions directly after receiving the unilateral close event. The
resolutions won't change so there's not really necessary to wait to log
them, and this greatly simplifies the code.
2018-08-22 23:51:04 +02:00
Johan T. Halseth
245dae0071
contractcourt/channel_arbitrator: properly commit to next state 2018-08-22 23:51:04 +02:00
Conner Fromknecht
9c5c1d0cb5
htlcswitch/switch: prevent panic for unknown error decryptor 2018-08-22 10:26:27 -07:00
Conner Fromknecht
80814cf11d
lnd_test: satisfy linter alignment 2018-08-22 10:26:27 -07:00
Conner Fromknecht
b59fea460a
htlcswitch/switch: make local response handling async
This commit moves the logic handling responses to
locally-initiated payments to be asynchronous. The
reordering of operations into handleLocalDispatch
brings a serious performance burden to the switch's
main event loop. However, the at-most once semantics
of circuit map and idempotency of cleanup methods
allows concurrent operations to run in parallel.

Prior to this commit, the async_payments_benchmark
would timeout due to the forcibly serial nature of
the prior design. With this change, there is no
perceptible difference in the benchmark OMM, even
though we've added two extra db calls.
2018-08-22 10:26:26 -07:00
Olaoluwa Osuntokun
9f4685228e
Merge pull request #1763 from valentinewallace/listinvoices-pagination
channeldb+rpc: add pagination of listinvoices
2018-08-21 20:14:18 -07:00