Commit Graph

330 Commits

Author SHA1 Message Date
Joost Jager
c1d845aa0d
cnct: reuse sweep tx logic for commit resolver
Removes duplicate sweep tx code from commit resolver
and delegates generation to UtxoSweeper in the sweep
package.
2018-10-17 12:44:34 +02:00
Joost Jager
4dab405623
sweep: move sweep tx generation into sweep package
Sweep txes are currently generated in multiple locations. Moving
the sweep tx generation into a shared package will allow us to
reuse that logic.
2018-10-17 12:44:33 +02:00
Olaoluwa Osuntokun
13802b4218
Merge pull request #1963 from wpaulino/create-chan-buckets-once
channeldb: ensure channel buckets are only created once
2018-09-28 17:06:39 -07:00
Johan T. Halseth
addb4aed89
funding+server: make FindChannel return OpenChannel instead of LightningChannel 2018-09-28 08:59:27 +02:00
CirroStorm
f594a57c94 lnwallet: remove need for lnwallet to have access to the private key
This paves the way for lnd to work with hardware wallets, in which case it will not have access to the private key.
2018-09-27 20:58:46 -07:00
Olaoluwa Osuntokun
6afee3d099
Merge pull request #1856 from maurycy/typos
multi: fix various typos in comments
2018-09-27 20:38:10 -07:00
Joost Jager
9f6fb1e128
utxonursery: test restart behaviour 2018-09-23 15:52:45 -07:00
Wilmer Paulino
99a4952239
server+peer: check ErrEdgeNotFound when enabling/disabling a channel
In this commit, we also check ErrEdgeNotFound when attempting to send an
active/inactive channel update for a channel to the network. We do this
as it's possible that a channel has confirmed, but it still does not
meet the required number of confirmations to be publicly announced.
2018-09-21 17:24:36 -07:00
Johan T. Halseth
0a5f982280
utxonursery: pass broadcastHeight to registerPreschoolConf
In this commit IncubateOutputs are given an extra parameter
broadcastHeight, which is passed from the server and used when called
registerPresschoolConf.

Earlier the utxonursery used the bestHeight as height hint in this case,
which would be wrong in the cases where we got outputs for incubation
which was confirmed below the best height.
2018-09-20 13:16:39 +02:00
Johan T. Halseth
3a67fe2552
contractcourt+server: make IncubateOutputs take broadcastHeight 2018-09-20 12:54:48 +02:00
Wilmer Paulino
fb059ddaa5
server: start tor controller if we should listen for inbound connections
over Tor

In this commit, we fix a small bug where we would attempt to start the
Tor controller even if we were not requested to automatically create and
onion service in order to listen for inbound connections over Tor.
2018-09-14 13:45:06 -07:00
Wilmer Paulino
95560238ce
server: update to lastest tor controller api 2018-09-11 19:37:12 -07:00
maurycy
ac24b12bf2
multi: fix various typos in comments 2018-09-07 06:51:49 +02:00
Wilmer Paulino
59c404a6d3
server: ensure persistent connections to tor addrs are made if active
In this commit, we restrict the persistent connection logic on startup
to only attempt to establish connections to Tor addresses if Tor
outbound support is enabled. Otherwise, we'll continually attempt to
reach the address even though we never will.
2018-09-06 18:51:19 -07:00
Olaoluwa Osuntokun
4100dfcf6b
Merge pull request #1801 from cfromknecht/remove-initial-graph-sync-request
server: Stop requesting initial graph sync
2018-09-05 19:16:56 -07:00
Olaoluwa Osuntokun
d2a7d910b7
Merge pull request #1825 from Roasbeef/extra-gossip-message-data
channeldb+discovery: ensure we store, validate and propagate announcements with opaque data
2018-09-05 17:53:02 -07:00
Olaoluwa Osuntokun
d1a80e35ef
Merge pull request #1841 from cfromknecht/sync-gq-start
peer: Synchronous registration of gossip queries
2018-09-05 16:37:03 -07:00
Olaoluwa Osuntokun
7808288249
chanseries+server: populate ExtraOpaqueData field when reading from disk 2018-09-04 20:52:45 -07:00
Olaoluwa Osuntokun
309e656a97
Merge pull request #1839 from cfromknecht/assume-channel-valid
routing: Assume channel valid
2018-09-04 20:50:06 -07:00
Olaoluwa Osuntokun
7435fba78b
Merge pull request #1836 from cfromknecht/reconnect-to-all-known-addrs
server: Reconnect to all known addrs for persistent peers
2018-09-04 19:44:35 -07:00
Conner Fromknecht
2415675c3d
server: move gossip dispatch to peer
See next commit msg for more detail.
2018-09-04 17:28:50 -07:00
Conner Fromknecht
21a4e21863
server: stop requesting initial graph sync
In this commit, we remove signaling for initial routing
dumps, which create unnecessary log spam, bandwidth, and
CPU. Now that gossip syncing is in full force, we will
instead opt to use the more efficient querying/set
reconciliation. Other nodes may still request initial
gossip sync from us, and we will respond.
2018-09-04 05:04:21 -07:00
Conner Fromknecht
8d7eb41d48
server: always backoff for unstable peers
This commit modifies the connection peer backoff
logic such that it will always backoff for "unstable"
peers. Unstable in this context is determined by
connections whose duration is shorter than 10
minutes. If a disconnect happens with a peer
whose connection lasts longer than 10 minutes,
we will scale back our stored backoff for that peer.

This resolves an issue that would result in a tight
connection loop with remote peers. This stemmed
from the connection duration being very short,
and always driving the backoff to the default
backoff of 1 second. Short connections like
this are now caught by the stable connection
threshold.

This also modifies the computation on the
backoff relaxation to subtract the connection
duration after applying randomized exponential
backoff, which offers better stability when
the connection duration and backoff are roughly
equal.
2018-09-04 03:40:08 -07:00
Conner Fromknecht
f33cfdaa07
server: pass AssumeChannelValid to router 2018-09-03 20:15:18 -07:00
Conner Fromknecht
09992f3fb0
server: remove unused lightningID field 2018-09-03 18:11:25 -07:00
Conner Fromknecht
9c35528fce
server: attempt reconnection to all known addresses 2018-09-03 18:11:21 -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
Olaoluwa Osuntokun
745cc3a8f4
server: don't attempt to disable private channels 2018-08-25 17:30:08 -07:00
Olaoluwa Osuntokun
a1a6845fb5
Merge pull request #1731 from halseth/link-policy-persist
Correctly apply min_htlc to forwarding policy
2018-08-23 19:21:44 -07:00
Johan T. Halseth
19e3a194fa
peer+server: make fetchLastChanUpdate _always_ fetch our own update
This commit fixes a bug that would cause us to fetch our peer's
ChannelUpdate in some cases, where we really wanted to fetch our own.

The reason this happened was that we passed the peer's pubkey to
fetchLastChanUpdate, making us match on their policy. This would lead to
ChannelUpdates being sent during routing which would have no effect on
the attempted path.

We fix this by always use our own pubkey in fetchLastChanUpdate, and
also uses the common methods within the server to be able to extract the
update even when only one policy is known.
2018-08-23 07:50:18 +02:00
Johan T. Halseth
de5e9e139c
server: make extractChannelUpdate extract from set of potential policies 2018-08-23 07:50:17 +02:00
Johan T. Halseth
67d36eb79d
funding: make SendAnnouncement return error chan instead of error 2018-08-23 07:40:41 +02:00
Wilmer Paulino
6c903393e5 router+server: use first hop channel id rather than node key 2018-08-20 21:04:52 -07:00
Olaoluwa Osuntokun
3f5ec99330
server: properly unlock within openchannel if peer not found 2018-08-18 18:17:55 -07:00
Olaoluwa Osuntokun
147596047f
Merge pull request #1687 from halseth/disable-inactive-channels
Send ChannelUpdate with Disabled bit if channel inactive for 20 minutes
2018-08-17 18:04:19 -07:00
Johan T. Halseth
4581aa313c
server: handle case where both policies are not present in fetchLastChanUpdateByOutPoint 2018-08-17 23:24:13 +02:00
Johan T. Halseth
5deffd228c
peer: call disableChannel with disabled=false after loading channels
This to ensure now active channel is available in the router, for path
finding, as it might have been disabled if the peer has been offline a
while.
2018-08-17 23:24:13 +02:00
Johan T. Halseth
e9cc7492a9
server: add goroutine watchChannelStatus
This commit adds a goroutine watchChannelStatus to the server, which
will query the switch for the status of all open channels every
InactiveChanTimeout / 4. If a channel's status has remained unchanged
during the last InactiveChanTimeout it'll send out a ChannelUpdate
setting the disabled bit accordingly.
2018-08-17 23:24:13 +02:00
Johan T. Halseth
b5bfdd72b5
server+peer: rename disableChannel->announceChanStatus
Now takes a boolean whether to disable/activate, and keeps track of the
last update sent to avoid sending duplicates.
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
Wilmer Paulino
2908f672c3
server: add minConfs field to openChanReq 2018-08-16 20:19:27 -07:00
Wilmer Paulino
5c414bb1d0
multi: make OpenChannel take in openChanReq 2018-08-16 20:19:26 -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
a6e7b35872
server: use blocking RemoveLink to shutdown links 2018-08-10 11:42:25 -07:00
Olaoluwa Osuntokun
61f5b3e3f1
Merge pull request #1709 from Empact/noisedial
Move noiseDial from config.go to server.go
2018-08-09 21:43:37 -07:00
Olaoluwa Osuntokun
d3b1b9aa98
Merge pull request #1668 from cfromknecht/interface-tickers
Ticker Package
2018-08-09 20:55:25 -07:00
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -07:00
Ben Woosley
896128efd0
Move noiseDial from config.go to server.go
noiseDial is only called from server.go, has nothing to do with configuration,
and moving it removes config.go's reliance on btcec and brontide.
2018-08-09 15:13:05 -04:00