Commit Graph

8246 Commits

Author SHA1 Message Date
Joost Jager
64f4421d6c
htlcswitch/test: add test cases that triggers empty commit sig
Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2019-11-06 09:21:21 +01:00
Joost Jager
517ad4e4f5
lnwallet: log empty commit sig event
To facilitate the logging, this commit adds a new OweCommitment method.
For the logging, we only need to consider the remote perspective. In a
later commit, we'll also start using the local perspective to support
the decision to send another signature.
2019-11-06 09:21:19 +01:00
Olaoluwa Osuntokun
7ecb7136cf
Merge pull request #3442 from cfromknecht/router-registry
single-shot, sender-side mpp via sendtoroute
2019-11-04 17:50:59 -08:00
Olaoluwa Osuntokun
71730a15b4
Merge pull request #3674 from guggero/bakery-docs
doc: describe macaroon bakery
2019-11-04 17:32:27 -08:00
Conner Fromknecht
540e44e186
lntest/itest: expand testSingleHopSendToRoute matrix
In this commit, we refactor the testSingleHopSendToRoute test to support
table driven tests for various endpoints and payment types. Currently
only the main rpcserver's SendToRoute is tested, so we also add
support the SendToRouteSync and the routerrpc's SendToRoute.

The tests are also modified to have each endpoint perform a single-hop,
single-shot MPP payment. This asserts that the Hop messages are being
properly unmarshalled and that setting correctly yields a successful
payment. At the momemnt the receiver does not actually verify or use the
MPP fields presented in the onion, though this test will be expanded
later as those pieces are assembled.
2019-11-04 15:11:55 -08:00
Conner Fromknecht
18a06b0ed3
lntest: remove unnecessary wait from single-hop sendtoroute
We already wait for all channels to open before creating the payment
requests.
2019-11-04 15:11:39 -08:00
Conner Fromknecht
8cb17d5c1f
lnrpc/routerrpc/router_backend: populate and unmarshal mpp fields
This commit parses mpp_total_amt_msat and mpp_payment_addr from the
SendToRoute rpc and populates an MPP record on the internal hop
reprsentation. When the router goes to encode the onion packet, these
fields will be serialized for the destination. We also populate the mpp
fields when marshalling routes in rpc responses.
2019-11-04 15:11:23 -08:00
Conner Fromknecht
92aa78dd5f
lnrpc/rpc.proto: add mpp fields to Hop message
This commit add mpp_total_amt_msat and mpp_payment_addr to the Hop
message. Doing so enables users submitting mpp payments via rpc to
set these parameters for the destination. In addition, it will allow us
to display these fields in rpc responses.
2019-11-04 15:11:07 -08:00
Conner Fromknecht
014ea0abd0
htlcswitch/iterator: remove unused ExtraOnionBlob method 2019-11-04 15:10:50 -08:00
Conner Fromknecht
9e9b912d3a
multi: replace NotifyExitHopHtlc eob param with hop.Payload 2019-11-04 15:10:32 -08:00
Conner Fromknecht
70708e2e71
htlcswitch: return hop.Payload from HopIterator 2019-11-04 15:10:15 -08:00
Conner Fromknecht
4a6f5d8d3d
htlcswitch/hop/payload: parse option_mpp 2019-11-04 15:10:00 -08:00
Conner Fromknecht
6d971e5113
routing/route/route: add optional MPP field to Hop
This commit also modifies the Router serialization to persist the MPP
struct when present, and properly restore it when loading from disk.
2019-11-04 14:11:28 -08:00
Conner Fromknecht
b1b7ff8006
records/mpp: add MPP struct to create corresponding tlv.Record
Used to encode/decode MPP tlv records
2019-11-04 14:11:02 -08:00
Conner Fromknecht
b3b51923dc
tlv/truncated: add non-generic encoders for truncated types
These encoders can be composed to create composite types without
incurring additional allocations that would be required to pass the
truncated types through the generic interface.
2019-11-04 14:10:43 -08:00
Oliver Gugger
ae04bdb98a
doc: describe macaroon bakery 2019-11-04 15:07:24 +01:00
Olaoluwa Osuntokun
083b574fd8
autopilot: fix race condition in new test 2019-11-01 19:30:21 -07:00
Olaoluwa Osuntokun
acd8a6e302
Merge pull request #3470 from cfromknecht/invalid-onion-payload
htlcswitch+lnwire: invalid onion payload
2019-11-01 18:58:00 -07:00
Olaoluwa Osuntokun
38e313a869
Merge pull request #3633 from joostjager/safe-migrations
channeldb: isolate migrations
2019-11-01 18:28:56 -07:00
Olaoluwa Osuntokun
bef1cd01c7
Merge pull request #3520 from halseth/autopilot-heuristic-update-trigger
[autopilot] Trigger channel opening on external score update
2019-11-01 17:24:22 -07:00
Johan T. Halseth
e0744a3983
Merge pull request #3650 from guggero/update-grpc-gateway
proto+lnrpc: update gRPC-REST gateway to v1.8.6
2019-11-01 09:03:48 +01:00
Olaoluwa Osuntokun
4592f87033
Merge pull request #3653 from Roasbeef/external-funding-chainfees
chainfees: create new chainfees package extracting fees from lnwallet
2019-10-31 17:44:00 -07:00
Olaoluwa Osuntokun
cc159decf5
Merge pull request #3654 from Roasbeef/external-funding-chantype-bits
multi: convert the existing channeldb.ChannelType uint8 into a bit field
2019-10-31 17:24:20 -07:00
Olaoluwa Osuntokun
777ed104a3
chainfee: create new chainfee package extracting fees from lnwallet
In this commit, we create a new chainfee package, that houses all fee
related functionality used within the codebase. The creation of this new
package furthers our long-term goal of extracting functionality from the
bloated `lnwallet` package into new distinct packages. Additionally,
this new packages resolves a class of import cycle that could arise if a
new package that was imported by something in `lnwallet` wanted to use
the existing fee related functions in the prior `lnwallet` package.
2019-10-31 16:41:57 -07:00
Olaoluwa Osuntokun
a73ee28e46
multi: convert the existing channeldb.ChannelType uint8 into a bit field
In this commit, we convert the existing `channeldb.ChannelType` type
into a _bit field_. This doesn't require us to change the current
serialization or interpretation or the type as it is, since all the
current defined values us a distinct bit. This PR lays the ground work
for any future changes that may introduce new channel types (like anchor
outputs), and also any changes that may modify the existing invariants
around channels (if we're the initiator, we always have the funding
transaction).
2019-10-31 16:34:37 -07:00
Joost Jager
4486a06b1a
migration_01_to_11: remove version checking for migration tests 2019-10-31 11:25:07 +01:00
Johan T. Halseth
5a8ecfcc49
autopilot/agent_test: add TestAgentHeuristicUpdateSignal
TestAgentHeuristicUpdateSignal tests that upon notification about a
heuristic update, the agent reconsults the heuristic.
2019-10-31 10:19:50 +01:00
Johan T. Halseth
7524265ab1
autopilot: trigger agent channel open on new scores
This commit adds a new signal to the autopilot agent, meant to signal
when any of the available heuristics has gotten an update.

We currently use this to trigger a new channel opening after the
external scores have been updated.
2019-10-31 10:17:31 +01:00
Johan T. Halseth
f0ba4be758
autopilot/manager: fix slice modifications
When appending to a slice, there is no guarantee the slice won't be
modified. So instead of appending to the global slice
availableHeuristics, we create a temporary local one.
2019-10-31 10:17:31 +01:00
Johan T. Halseth
df5baa4275
autopilot/agent: trace log reason nodes being skipped 2019-10-31 10:17:31 +01:00
Oliver Gugger
b6c7ff8183
lnrpc: generate protos with new gateway version 2019-10-31 09:13:38 +01:00
Oliver Gugger
b6b57d1c00
proto: update to grpc-gateway v1.8.6 2019-10-31 09:13:33 +01:00
Joost Jager
fcf81ed8ff
Merge pull request #3556 from joostjager/query-mc-prob
routerrpc: add queryprob rpc
2019-10-31 08:03:29 +01:00
Joost Jager
60503d6c44
channeldb/migration_01_to_11: remove unused code 2019-10-31 07:18:36 +01:00
Conner Fromknecht
cba523ae30
htlcswitch/hop/payload: apply known constraints if required failure
This commit modifies the NewPayloadFromReader to apply known
presence/omission contraints in the event that the tlv parser returns an
unknown required type failure.

Now that the parser has been modified to finished parsing the stream to
obtain a proper parsed type set, we can accurately apply these higher
level validation checks. This overrides required type failures, such
that they are only returned if the sender properly abided by the
constraints on fields for which we know.

The unit tests are updated to create otherwise valid payloads that then
return unknown required type failures. In one case, a test which
previously returned an unknown required type failure is made to return
an included failure for the sid, indicating the unknown required type 0
is being overruled.
2019-10-30 21:21:10 -07:00
Conner Fromknecht
937b781276
htlcswitch/hop/payload: extend tests to required type failures 2019-10-30 21:20:49 -07:00
Conner Fromknecht
e85aaa45f6
tlv/stream: parse entire stream to find all required types 2019-10-30 21:20:29 -07:00
Conner Fromknecht
d08e8ddd61
routing/result_interpretation: process InvalidOnionPayload
An InvalidOnionPayload implies that the onion was successfully received
by the reporting node, but that they were unable to extract the
contents. Since we assume our own behavior is correct, this mostly
likely poins to an error in the reporter's implementation or that we
sent an unknown required type. Therefore we only penalize that single
hop, and consider the failure terminal if the receiver reported it.
2019-10-30 21:20:08 -07:00
Conner Fromknecht
3455f7965d
htlcswitch/link: return InvalidOnionPayload failure
This commit modifies the link return an InvalidOnionPayload failure when
it cannot parse a TLV payload. The offset is left at zero, since its
unclear how useful it will be in practice and would require some
significant reworkings of the abstractions in the tlv package.

TODO: add unit tests. currently none of the test unit infrastructure is
setup to handle TLV payloads, so this would require implementing a
separate mock iterator for TLV payloads that also supports injecting
invalid payloads. Deferring this non-trival effor till a later date
2019-10-30 21:19:53 -07:00
Conner Fromknecht
0fc506e044
lnwire/onion_error: add InvalidOnionPayload failure 2019-10-30 21:19:36 -07:00
Conner Fromknecht
3c91c3a8ff
htlcswitch/hop/payload: required failures with ErrInvalidPayload
This commit adds a hop.PayloadViolation enum which encompasses the cases
where the sender omits, includes, or requires a type that causes an
ErrInvalidPayload faiulre.

The existing Omitted bool is converted to this PayloadViolation, and
NewPayloadFromReader is updated to return such a failure with a
RequiredViolation when an unknown required type is detected.

The unit tests are updated to cover the three possible cases of
RequiredViolations, as well as included valid intermediate and final hop
tests.
2019-10-30 21:19:08 -07:00
Conner Fromknecht
2f8021d8db
routing/result_interpretation: fix off-by-one for incoming failure
Previously we would not mark a success for the first hop if the fail
source index was 2. We also add a test to assert this behavior.
2019-10-30 21:18:52 -07:00
Johan T. Halseth
64e5d06cd1
Merge pull request #2598 from skwp/docker-caching
Add source after installing apk packages to avoid breaking docker cache
2019-10-30 15:47:57 +01:00
Joost Jager
f5191440c5
channeldb: initialize migrations logger 2019-10-30 08:56:18 +01:00
Joost Jager
a8f077a841
Merge pull request #3558 from joostjager/non-strict-pathfinding
routing: non-strict path finding
2019-10-30 08:42:28 +01:00
Olaoluwa Osuntokun
0fdfb4d76f
Merge pull request #3646 from alrs/fix-routing-test-goroutine
routing: fix use of T.Fatal() in test goroutine
2019-10-29 20:00:30 -07:00
Lars Lehtonen
6254c53a4a
routing: fix use of T.Fatal() in test goroutine 2019-10-29 13:21:53 -07:00
Joost Jager
729c3a6bd6
routing: use unified policy for build route 2019-10-29 19:17:58 +01:00
Joost Jager
fb57255b5c
routerrpc: add mc probability query rpc
Probabilities are no longer returned for querymc calls. To still provide
some insight into the mission control internals, this commit adds a new
rpc that calculates a success probability estimate for a specific node
pair and amount.
2019-10-29 12:32:19 +01:00
Joost Jager
04e7c98461
routerrpc: create pair data proto message
With a separate proto message, it becomes possible to also return the
pair data for a single pair. This prepares for the new mc probability
querying rpc.
2019-10-29 12:32:17 +01:00