Commit Graph

6518 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
38769fb388 lnrpc/routerrpc: add protos for new Router sub-server 2019-02-20 16:10:24 -08:00
Olaoluwa Osuntokun
8a0d0ec98f
Merge pull request #2651 from kaplanmaxe/payinvoice-error-exit-code
lncli: returning non 0 exit code when paying invoice fails
2019-02-20 15:07:32 -08:00
Olaoluwa Osuntokun
2bf22617d4
Merge pull request #1595 from wpaulino/send-channel-update-reliably
discovery/gossiper: reliably send channel update msg to remote peer
2019-02-19 21:09:04 -08:00
Conner Fromknecht
0a3e1cfbe5
channeldb+witness_beacon: use sha256 lookup+delete witness 2019-02-19 17:06:42 -08:00
Conner Fromknecht
3428fde5ab
htlcswitch/link_test: batch preimage write test 2019-02-19 17:06:28 -08:00
Conner Fromknecht
76cecb1396
htlcswitch/link: batch write to preimage cache
This commit makes use of the batched AddWitness
method of the WitnessCache, in order to avoid
performing one write for each accepted preimage.

Additionally, this fixes an existing hole in the
consistency guarantees since the batched writes
are now guaranteed to take place before accepting
the next CommitSig. Previously, these writes were
processed in an unsynchronized go routine that
could be delayed arbitrarily long before being
executed.

With this change, the async_payments_benchmarks
actually shows a slight improvement in
performance, presumably because we no longer do
an individual write per preimage, even though
the execution is now explicitly in the critical
path. There is likely also a marginal performance
improvement from the reduction in goroutine
overhead.
2019-02-19 17:06:15 -08:00
Conner Fromknecht
29f07a58cb
cnct+lnwl+hswc: use lntypes.Preimage for witness beacon 2019-02-19 17:06:00 -08:00
Conner Fromknecht
2d8bc99d9e
lntypes/preimage: add MakePreimage initializer 2019-02-19 17:05:45 -08:00
Conner Fromknecht
e8b7f1fca3
channeldb/witness_cache: create AddSha256Witnesses helper + test 2019-02-19 17:05:30 -08:00
Conner Fromknecht
56b6becc48
channeldb/witness_cache_test: test batch preimage insertion 2019-02-19 17:05:17 -08:00
Conner Fromknecht
30f61b7630
multi: make AddPreimage variadic, optimistically compute key
In this commit, we modify the WitnessCache's
AddPreimage method to accept a variadic number
of preimages. This enables callers to batch
preimage writes in performance critical areas
of the codebase, e.g. the htlcswitch.

Additionally, we lift the computation of the
witnesses' keys outside of the db transaction.
This saves us from having to do hashing inside
and blocking other callers, and limits extraneous
blocking at the call site.
2019-02-19 17:05:04 -08:00
Olaoluwa Osuntokun
9d23d382fc
Merge pull request #2419 from cfromknecht/brontide-buffer-pool
brontide: read buffer pool
2019-02-18 17:51:17 -08:00
Olaoluwa Osuntokun
e65012a7ff
build: update to latest neutrino build
In this commit, we update lnd to build against the latest version of
neutrino. This new version fixes a bug left behind as a result of the
btcd filter bug fix. When we were comparing filters in order to ban
invalid peers, we used the old OP_RETURN filtering rather than the new
one. As a result, we might've rejected a valid filter/block as we were
applying the old (incorrect) rules.
2019-02-18 17:34:34 -08:00
Olaoluwa Osuntokun
c8b5e1f55e
Merge pull request #2411 from cfromknecht/chan-status-manager
netann: channel status manager
2019-02-18 17:16:30 -08:00
Max Kaplan
9bfb8224cd
lncli: returning non 0 exit code when paying invoice fails 2019-02-18 10:33:03 -05:00
Olaoluwa Osuntokun
44b8cd6699
Merge pull request #2602 from lightningnetwork/ticker-queue-modules
build: add module support for ticker and queue packages
2019-02-16 14:54:53 -08:00
Conner Fromknecht
2900d8aff8
brontide/noise: take read buffers from pool, return w/ finalizer 2019-02-15 19:33:23 -08:00
Conner Fromknecht
5d9514fbe4
buffer+pool: add buffer.Read and pool.ReadBuffer 2019-02-15 19:33:08 -08:00
Conner Fromknecht
6f96d04b72
multi: add buffer.Write and pool.WriteBuffer, make GCQueue generic 2019-02-15 19:31:24 -08:00
Conner Fromknecht
ca4226d429
brontide/listener: handle SetReadDeadline errors 2019-02-15 18:14:02 -08:00
Conner Fromknecht
41940c6c9e
brontide/conn: handle read timeout errors 2019-02-15 18:13:52 -08:00
Conner Fromknecht
04febab85c
brontide/noise: use static default ephemeral keygen closure 2019-02-15 18:13:43 -08:00
Conner Fromknecht
785740493e
brontide/noise: use statically allocated prologue 2019-02-15 18:13:34 -08:00
Wilmer Paulino
12168f022e
server+discovery: send channel updates to remote peers reliably
In this commit, we also allow channel updates for our channels to be
sent reliably to our channel counterparty. This is especially crucial
for private channels, since they're not announced, in order to ensure
each party can receive funds from the other side.
2019-02-14 18:33:27 -08:00
Wilmer Paulino
4996d49118
server+discovery: use reliableSender to replace existing resend logic 2019-02-14 18:33:27 -08:00
Wilmer Paulino
2f679f6015
discovery/reliable_sender: implement message-agnostic reliable sender
In this commit, we implement a new subsystem for the gossiper that
uses some of the existing logic for resending channel announcement
signatures and implements it in a way to make it message-agnostic,
meaning that any type of message can be resent. Along the way we also
modify the way this works to prevent multiple goroutines per peer _and_
message.

A peerHandler will be spawned for each peer for which we attempt to send
a message reliably to. This handler is responsible for managing requests
to reliably send messages to a peer while also taking the peer's
connection lifecycle into account by requesting notifications for when
the peer connects/disconnects. A peer connection notification is first
requested to determine when we should attempt to send any pending
messages. After the messages are sent, a peer disconnection notification
is requested to ensure we don't continue to request connection
notifications while the peer remains connected. Once there are no more
pending messages left to be sent for a given peer, the peerHandler can
be torn down.
2019-02-14 18:33:27 -08:00
Wilmer Paulino
6e556aa897
discovery/gossiper_test: prevent race conditions within mockGraphSource 2019-02-14 18:33:27 -08:00
Wilmer Paulino
73b4bc4b68
server+discovery: remove channeldb.DB reference within the gossiper
Now that we've replaced the built-in messageStore with the
channeldb.GossipMessageStore, the reference to channeldb.DB is no longer
needed.
2019-02-14 18:29:39 -08:00
Wilmer Paulino
2277535e6b
server+discovery: replace gossiper message store with MessageStore 2019-02-14 18:29:39 -08:00
Wilmer Paulino
9febc9cc04
channeldb: add gossiper message store key migration
In this commit, we introduce a migration for the message store
sub-bucket that will migrate all keys within it to a new key format.
This new key format is composed of the peer's public key, followed by
the short channel ID, followed by the message type. This migration is
needed in order to provide backwards-compatibility with messages that
were previously stored before the introduction of the new key format.
2019-02-14 18:29:39 -08:00
Wilmer Paulino
847b064461
discovery/message_store: add gossip message store
In this commit, we add a new store within the database that'll be
responsible for storing gossip messages which we need to reliably send
to peers. This aims to replace the current messageStore that exists
within the gossiper, so much of this logic is borrowed from there.
One of the main differences between the two is that we now index
messages with a new key format in which we take into account the
message's type. This allows us to store different messages for a
specific channel with a peer. The old key format is still supported in
order to prevent a database migration.
2019-02-14 18:29:39 -08:00
Conner Fromknecht
de282172a1
peer+server+test_utlils: use new ChanStatusManager
This commit hooks up the new netann.ChanStatusManager,
replacing the prior method which used the
watchChannelStatus goroutine.
2019-02-14 17:13:44 -08:00
Conner Fromknecht
8b185e6301
test_utils: waitgroup manually spawned goroutines
Found that his can sometimes cause a panic with a
negative waitgroup counter.
2019-02-14 17:13:33 -08:00
Conner Fromknecht
ef41fc6249
lnd_test: set valid chan status config flags 2019-02-14 17:13:21 -08:00
Conner Fromknecht
4686db4196
config+server+lnd_test: expose chan status manager config options
Exposes the three parameters that dictate
the behavior of the channel status manager:
 * --chan-enable-timeout
 * --chan-disable-timeout
 * --chan-status-sample-interval
2019-02-14 17:13:11 -08:00
Conner Fromknecht
cd467195d7
netann/chan_status_manager_test: adds ChanStatusManager unit tests 2019-02-14 17:12:59 -08:00
Conner Fromknecht
53797b7dc7
netann/chan_status_manager: adds ChanStatusManager 2019-02-14 17:12:49 -08:00
Conner Fromknecht
b405c87578
netann/channel_state: defines ChanStatus and per-channel state 2019-02-14 17:12:37 -08:00
Conner Fromknecht
559255e6f6
netann/interface: defines chan status mgr interfaces 2019-02-14 17:12:25 -08:00
Conner Fromknecht
a0daf6f59f
netann/channel_update_test: adds unit tests UpdateDisableFlag 2019-02-14 17:12:13 -08:00
Conner Fromknecht
1a7fd6e6f1
netann/channel_update: exposes channel update helpers moved from server 2019-02-14 17:12:03 -08:00
Olaoluwa Osuntokun
81783a60dc
Merge pull request #2212 from halseth/autopilot-bos-scores
Bos score enabled Autopilot
2019-02-14 15:22:13 -08:00
Johan T. Halseth
acd458db56
Merge pull request #2549 from halseth/router-ignore-unknown-chanupdate
routing: ignore ChannelUpdates for unknown channels
2019-02-14 15:32:52 +01:00
Johan T. Halseth
01ea797d78
routing/router test: add TestIgnoreChannelEdgePolicyForUnknownChannel 2019-02-14 14:21:18 +01:00
Johan T. Halseth
2b012b06a0
channeldb/graph test: add test for update policy for unknown edge 2019-02-14 14:21:18 +01:00
Johan T. Halseth
23ce82f4e3
routing/router: don't apply channel policy updates for unknown channels 2019-02-14 14:21:18 +01:00
Johan T. Halseth
25f1252019
autopilot/externalscoreattach_test: add TestSetNodeScores 2019-02-14 12:37:25 +01:00
Johan T. Halseth
5dabb1ae29
autopilot+lnrpc: wire up SetNodeScores RPC to set scores of agent 2019-02-14 11:41:47 +01:00
Johan T. Halseth
b23e53ea33
autopilot/interface+externalscoreattach: define ScoreSettable
ScoreSettable is an interface that let caller set external scores for
the heuristic. The ExternalScoreAttachment and WeightedCombAttachment
heuristics implement this interface.
2019-02-14 11:41:47 +01:00
Johan T. Halseth
83edcb7153
lnrpc: add API SetScores
Used to set the external scores for the running autopilot agent.
2019-02-14 11:41:47 +01:00