Commit Graph

4845 Commits

Author SHA1 Message Date
Johan T. Halseth
887722f38f
htlcswitch/switch: add method HasActiveLink 2018-08-17 23:24:12 +02:00
Johan T. Halseth
940d0735f8
lnd_test: use dave to listen for ChannelUpdates in testSendUpdateDisableChannel
This commit changes the test testSendUpdateDisableChannel to use Dave to
listen for channel updates, as was originally intended.

Since a ChannelUpdate won't propagate in the network if the channel is
already closed (if the closing transaction has been mined), we change
the closing procedure to initiate the closing process, wait for the
ChannelUpdates, then finally mining the closing transaction. This avoids
a propagation race between the mined block and the ChannelUpdate.
2018-08-17 23:24:12 +02:00
Johan T. Halseth
304577f617
server: make sure timestamp always increases when creating new ChannelUpdate 2018-08-17 23:24:12 +02:00
Johan T. Halseth
8826db32e8
server: let gossiper hand policy update to router
ProcessLocalAnnouncement will attempt to call UpdateEdge with the new
policy. If we call it manually before handing it to the gossiper, that
call will fail with "Outdated" and the announcement won't propagate.
2018-08-17 23:24:12 +02:00
Olaoluwa Osuntokun
c6318eb614
Merge pull request #1741 from halseth/autopilot-no-dc
autopilot: check if already connected before returning error
2018-08-17 14:11:58 -07:00
Johan T. Halseth
2a3b52535e
autopilot: check if already connected before returning error
This commit fixes a small bug that could cause us to disconnect an
already connected peer if no addresses where provided to the ConnectPeer
method. Now we instead first check if we are already connected, and
return early.
2018-08-17 09:26:54 +02:00
Olaoluwa Osuntokun
643618b4f6
Merge pull request #1694 from wpaulino/autopilot-reachability-test
autopilot: add peer reachability test before tracking funding as pending
2018-08-16 20:18:49 -07:00
Wilmer Paulino
454b549c7e
autopilot+pilot: refactor connection logic out of OpenChannel
In this commit, we refactor the existing connection logic outside of the
ChanController's OpenChannel method. We do this as previously it was
possible for peers to stall us while attempting to connect to them. In
order to remedy this, we now attempt to connect the peer before tracking
them in our set of pending opens.
2018-08-16 20:17:03 -07:00
Olaoluwa Osuntokun
fb927442c5
Merge pull request #1739 from Roasbeef/graph-private-chan-node-cleanup
channeldb: ensure we remove update index entries for nodes upon deletion
2018-08-16 19:20:00 -07:00
Wilmer Paulino
2fbe95ebba
autopilot: modify OpenChannel to no longer take in set of addrs 2018-08-16 19:19:30 -07:00
Olaoluwa Osuntokun
9353ab00b1
channeldb: ensure that we remove update index entries for nodes upon deletion 2018-08-16 18:22:55 -07:00
Olaoluwa Osuntokun
06d03b55a3
channeldb: add new TestNodePruningUpdateIndexDeletion test
In this commit, we add a new test to expose a lurking bug within the
graph database code. As is, when we go to delete a node from the
database, we don't also remove the entries within the update index. As a
result, if a user attempted to call NodeUpdatesInHorizon (or typically
as part of the p2p handshake), we would error out, as we would try to
read a node that no longer existed in the graph, as it was pruned.
2018-08-16 18:20:58 -07:00
Olaoluwa Osuntokun
4492cb934f
Merge pull request #1732 from wpaulino/no-macaroons-change-password
walletunlocker: avoid returning error if macaroon files don't exist
2018-08-16 17:15:12 -07:00
Wilmer Paulino
b3edc5c257
walletunlocker: avoid returning error if macaroon files don't exist
In this commit, we fix a bug where it's possible that changing the
wallet's password fails due to not being able to remove non-existent
macaroon files. Since it's possible to run lnd without creating them,
changing the wallet's password would always result in a failure.
2018-08-16 16:17:54 -07:00
Olaoluwa Osuntokun
90cdc9da8f
channeldb: add String() method for EdgePoint
In this commit we fix a minor logging artifact. After the switch to
EdgePoint, the FilteredChainView implementations will try to log the
struct directly, as prior they would have an outpoint object. We restore
this behavior by adding a String() method to EdgePoint which will simply
proxy through to the outpoint so we can log that directly.
2018-08-15 21:43:39 -07:00
Olaoluwa Osuntokun
bd62ef6411
funding: properly log pubkey of peer within handleInitFundingMsg
Before this commit, we would log the struct of the pubkey, rather than
the serialized compressed version.
2018-08-15 21:41:53 -07:00
Olaoluwa Osuntokun
4731e1a3e2
Merge pull request #1692 from wpaulino/unadvertised-autopilot
autopilot+config: support opening private channels with autopilot agent
2018-08-15 21:26:05 -07:00
Olaoluwa Osuntokun
15eededf45
Merge pull request #1658 from cfromknecht/async-peer-start
[server]: Start Peers Asynchronously
2018-08-15 20:49:56 -07:00
Olaoluwa Osuntokun
fc8626c806
Merge pull request #1726 from Roasbeef/fix-closed-chan-summaries-and-chancfg
multi: ensure closed channel summaries are fully populated, ensure KeyLocators are always set
2018-08-15 20:11:01 -07:00
Olaoluwa Osuntokun
b59139f533
build: update to latest version of neutrino 2018-08-15 16:14:28 -07:00
Olaoluwa Osuntokun
917f929e70
keychain: use t.Helper() instead of manually fetching the line no from the runtime 2018-08-15 16:14:02 -07:00
Olaoluwa Osuntokun
1ff596ecd7
build: update btcwallet to point to latest version 2018-08-14 19:11:42 -07:00
Olaoluwa Osuntokun
26032f5956
channeldb: extend TestFetchClosedChannels to populate local chan cfg properly 2018-08-14 19:11:41 -07:00
Olaoluwa Osuntokun
cf06b041a4
keychain: extend TestKeyRingDerivation to check KeyLocators of derived keys 2018-08-14 19:11:41 -07:00
Olaoluwa Osuntokun
ad25ae1a07
keychain: ensure we properly set the KeyLocator for keys from DeriveNextKey
In this commit, we fix a slight bug in the existing implementation of
DeriveNextKey for btcwallet. Before this commit, we would only set the
public key, and not also the derivation path. It's important that we
also set the path information, as in the near future we'll be using the
KeyDescriptors returned from this method to create static channel back
ups. With these static backups, the key alone may be insufficient to
re-derive the private key as we may need to fallback to brute forcing in
order to re-derive the key as it's possible we add new key families in
the future.
2018-08-14 19:11:40 -07:00
Olaoluwa Osuntokun
e97e4c1f5d
contractcourt: set auxiliary chan recovery info for all created chan close summaries 2018-08-14 19:11:40 -07:00
Olaoluwa Osuntokun
c37c9db2de
funding: properly set auxiliary channel recovery info in close chan summaries 2018-08-14 19:11:40 -07:00
Olaoluwa Osuntokun
b06dabfcb9 lnwallet: properly set auxiliary channel recovery info in NewUnilateralCloseSummary
In this commit, we fix a slight bug by ensuring that the revocation info
at the final state of the channel, as well as the local chan config is
properly set within the channel close summary created within
NewUnilateralCloseSummary. Before this commit, for all cooperative close
transactions, this state would _only_ include the pubkey itself, which
in some cases may not be sufficient to re-derive the key if needed.
2018-08-14 19:11:18 -07:00
Olaoluwa Osuntokun
999f4a742c
Merge pull request #1460 from rawtxapp/lncli-confirm-payreq
Adds extra confirmation to payinvoice and sendpayment, can be bypassed by force.
2018-08-14 16:48:53 -07:00
Lightning Koala
fab1aa2d49 docs: Add tlsextraip + tlsextradomain to sample config (#1665) 2018-08-13 22:10:54 -07:00
Conner Fromknecht
d4d90979ef
peer: increase peer write timeout to 50 seconds
Sometimes when performing an initial sync, the remote
node isn't able to pull messages off the wire because
of long running tasks and queues are saturated. With
a shorter write timeout, we will give up trying to send
messages and teardown the connection, even though the
peer is still active.
2018-08-13 21:55:32 -07:00
Conner Fromknecht
121252934b
server: rearrange peer lifecyle helpers for readability 2018-08-13 21:55:32 -07:00
Conner Fromknecht
0ee0abc166
server: add async peer Start() + safer cleanup
This commit adds asynchronous starting of peers,
in order to avoid potential DOS vectors. Currently,
we block with the server's mutex while peers exchange
Init messages and perform other setup. Thus, a remote
peer that does not reply with an init message will
cause server to block for 15s per attempt.

We also modify the startup behavior to spawn
peerTerminationWatchers before starting the
peer itself, ensuring that a peer is properly
cleaned up if the initialization fails. Currently,
failing to start a peer does not execute the bulk
of the teardown logic, since it is not spawned
until after a successful Start occurs.
2018-08-13 21:52:37 -07:00
Conner Fromknecht
a1abb11dc5
peer: add ready chan arg to WaitForDisconnect
This commit adds additional synchronization logic to
WaitForDisconnect, such that it can be spawned before
Start has been executed by the server. Without
modification, the current version will return
immediately since no goroutines will have been
spawned.

To solve this, we modify WaitForDisconnect to block until:
 1) the peer is disconnected,
 2) the peer is successfully started,
before watching the waitgroup.

In the first case, the waitgroup will block until all
(if any) spawned goroutines have exited. Otherwise, if
the Start is successful, we can switch to watching the
waitgroup, knowing that waitgroup counter is positive.
2018-08-13 21:52:32 -07:00
Olaoluwa Osuntokun
7a113d469b
Merge pull request #1551 from cfromknecht/switch-revert-replace-link
[htlcswitch]: revert replace link, ensure removed links are stopped
2018-08-13 21:44:42 -07:00
Olaoluwa Osuntokun
5efc1229bf
Merge pull request #1439 from valentinewallace/historical-block-epoch-ntfns
Historical block epoch ntfns
2018-08-13 21:18:36 -07:00
Olaoluwa Osuntokun
35363ee9a8
Merge pull request #1725 from wpaulino/manual-fee-floor
rpcserver: enforce fee floor for fee rates input by the user
2018-08-13 21:03:37 -07:00
Wilmer Paulino
29efb02968
rpcserver: enforce fee floor for fee rates input by the user
In a previous commit, we modified our fee rates to be sat/kw internally
as it was possible that the estimated fee rate was not enough to
properly broadcast the transaction. To remedy this, we decided to add a
fee floor, but this would only be enforced when querying the fee
estimator. In this commit, we attempt to do the same thing, but for fee
rates input manually by the user.
2018-08-13 14:39:08 -07:00
Olaoluwa Osuntokun
72aa79692c
Merge pull request #1722 from halseth/chan-status-print
peer: print ChanStatus return value, not address
2018-08-12 20:56:47 -07:00
Valentine Wallace
fb7deac898
chaintnfs/interface_test: test notifiers handling missed blocks
Tests for the case where a chain backend skips a series of blocks, such that the notifier's best block is out of date. Also tests the case where a notifier's best block has been reorged out of the chain.
2018-08-11 22:45:25 -07:00
Valentine Wallace
dea22eb874
chainntnfs/interface_test: add test for client catchup on block ntfns
This tests the case where a client registers for block notifications with an outdated best block, to ensure that the client is properly caught up on the blocks that it has missed.
2018-08-11 22:45:17 -07:00
Valentine Wallace
f6ba64056a
chainntnfs/interface_test: utilize TestChainNotifier interface in tests
Switches all ChainNotifier parameters to be TestChainNotifiers. This allows access to the extra testing methods provided by the TestChainNotifier interface.
2018-08-11 22:45:17 -07:00
Valentine Wallace
b3a5b3b576
chainntnfs: add ChainNotifier test interface for test methods
TestChainNotifier wraps the ChainNotifier interface to allow adding additional testing methods with access to private fields in the notifiers. These testing methods are only compiled when the build tag "debug" is set. UnsafeStart allows starting a notifier with a specified best block.

UnsafeStart is useful for the purpose of testing cases where a notifier's best block is out of date when it receives a new block.
2018-08-11 22:45:03 -07:00
Johan T. Halseth
64c2c6b118
peer: print ChanStatus return value, not address 2018-08-11 12:51:50 +02:00
Wilmer Paulino
89325a13b7
autopilot+config: support opening private channels with autopilot agent 2018-08-10 20:45:59 -07:00
Conner Fromknecht
f84cd14b12
htlcswitch/switch: permit link shutdown mid-forwarding
In this commit, we thread through a link's quit channel into
routeAsync, the primary helper method allowing links to send
htlcPackets through the switch. This is intended to remove
deadlocks from happening, where the link is synchronously
blocking on forwarding packets to the switch, but also
needs to shutdown.
2018-08-10 11:42:26 -07:00
Conner Fromknecht
0fef1c71fe
htlcswitch/link: pass link quit to ForwardPackets 2018-08-10 11:42:26 -07:00
Conner Fromknecht
d08003b285
htlcswitch/link_test: adds TestChannelLinkShutdownDuringForward
This commit adds a test that verifies Stop does not block
if the link is concurrently forwarding incoming Adds to
the switch. This test fails prior to the commits that
thread through the link's quit channel.
2018-08-10 11:42:26 -07:00
Conner Fromknecht
ad68009ec5
chancloser: remove error returned from unregisterChannel 2018-08-10 11:42:25 -07:00
Conner Fromknecht
11f02de3b3
htlcswitch/link_test: removes unnecessary WaitForShutdown
The new RemoveLink method blocks until the link has
been fully stopped, so we no longer need to wait
for it explicitly.
2018-08-10 11:42:25 -07:00