Commit Graph
100 Commits
Author SHA1 Message Date
Conner Fromknecht 59c4db7f33 Merge pull request #3756 from cfromknecht/non-verbose-unit-tests
Makefile: non-verbose unit tests
2019-11-24 06:39:31 -08:00
Conner Fromknecht a83958408d Merge pull request #3648 from cfromknecht/safe-disconnect
config+itest: allow unsafe disconnect by default
2019-11-22 21:07:17 -08:00
Conner Fromknecht 4c5b251748 Merge pull request #3750 from halseth/itest-flake-replacement-forceclose
lnd_test: fix race condition on simultanous force closes
2019-11-22 13:59:31 -08:00
Conner Fromknecht b07fb37c34 Merge pull request #3751 from halseth/itest-numactivenodes-mtx
lntest/node: add numActiveNodesMtx
2019-11-22 13:56:45 -08:00
Conner Fromknecht dd13a3c0d8 Makefile: make unit tess non-verbose
Makes it easier to spot failures without scrolling through pages of
successful tests.
2019-11-22 12:29:02 -08:00
Conner Fromknecht 9287610b83 lnrpc: fix nanonsecond typo 2019-11-22 12:23:35 -08:00
Conner Fromknecht 3b253e05f6 multi: restructure invoice Terms field
This commit restructures an invoice's ContractTerms to better encompass
the restrictions placed on settling. For instance, the final ctlv delta
and invoice expiry are moved from the main invoice body (where
additional metadata is stored). Additionally, it moves the State field
outside of the terms since it is rather metadata about the invoice
instead of any terms offered to the sender in the payment request.
2019-11-22 02:25:02 -08:00
Conner Fromknecht 6cabea563e channeldb/invoices: optimize deserializeHtlcs
Instead of allocating a byte slice to read in each htlc's raw TLV
stream, use a LimitReader to truncate the stream to the proper length.
2019-11-22 02:24:44 -08:00
Conner Fromknecht 4c872c438b channeldb: complete migration 12 for TLV invoices 2019-11-22 02:24:28 -08:00
Conner Fromknecht 76682ad820 channeldb/migration12: add tlv invoice migration tests 2019-11-22 02:24:11 -08:00
Conner Fromknecht 4b358aa2ad channeldb/migration12: write out invoices using TLV encoding 2019-11-22 02:23:59 -08:00
Conner Fromknecht 0f8048d336 channeldb/migration12: copy invoice deserialization 2019-11-22 02:23:47 -08:00
Conner Fromknecht c6a01f02cd lnwire/features: add Encode256 and Decode256
These will allow us to serialize invoice features bits without double
encoding the length.
2019-11-22 02:23:35 -08:00
Conner Fromknecht 76a2dfd8a6 lnrpc: remove receipt field from invoice 2019-11-22 02:23:24 -08:00
Conner Fromknecht 063f24f2ed channeldb+routing: expose HTLCs in payment subscriptions
This commit modifies the FetchPayment method to return MPPayment structs
converted from the legacy on-disk format. This allows us to attach the
HTLCs to the events given to clients subscribing to the outcome of an
HTLC.

This commit also bubbles up to the routerrpc/router_server, by
populating HTLCAttempts in the response and extracting the legacy route
field from the HTLCAttempts.
2019-11-19 20:43:38 -08:00
Conner Fromknecht 68916eb4b7 routerrpc: add HTLCAttempts to PaymentStatus 2019-11-19 20:42:38 -08:00
Conner Fromknecht 01cecb1f27 multi: rename to FailureReasonPaymentDetails
Prior name is too long XD
2019-11-19 20:42:21 -08:00
Conner Fromknecht e9eabed99c lntest: assert mpp fields in listpayments 2019-11-19 20:41:58 -08:00
Conner Fromknecht 997500b08d lnrpc+rpcserver: populate experimental MPP fields in ListPayment rpc 2019-11-19 20:41:44 -08:00
Conner Fromknecht d1f245e791 lnrpc: expose new MPP fields on list payments 2019-11-19 20:41:27 -08:00
Conner Fromknecht 77602451b8 channeldb: add MPPayment from FetchPayments 2019-11-19 20:41:08 -08:00
Conner Fromknecht 9e019407fb routing/control_tower: fix PaymentResult godocs 2019-11-19 20:40:44 -08:00
Conner Fromknecht fbd599a2cb multi: rename Payment.PaymentPreimage to Payment.Preimage
Preliminary step to exposing PaymentPreimage() as a method that can be
shared between legacy payments and mutli-path payments.
2019-11-19 20:40:29 -08:00
Conner Fromknecht 216b933d9b config+itest: allow unsafe disconnect by default
This commit beings the process of deprecating unsafe-disconnect. Many
moons ago this was disallowed to prevent concurency bugs surrounding
reconnect. Despite the name, it has been safe to enable this feature for
well over a year, as several PRs have been merged that addressed the
possible issues that existed when the feature was added.
2019-11-19 20:13:04 -08:00
Conner Fromknecht aa3e74043d lntest/harness: improve error message for AssertChannelExists
predErr wasn't always being set when the predicate failed, replace with
wait.NoError.
2019-11-19 20:12:48 -08:00
Conner Fromknecht c9c7216768 lntest/itest: remove global alice and bob from disconnect test
This will allow us to start Alice and Bob with additional arguments once
we switch to making unsafe-disconnect true by default.
2019-11-19 20:12:29 -08:00
Conner Fromknecht 8e10da03c7 lntest/itest: move chanpoint instantiation down to where it's used 2019-11-19 20:12:07 -08:00
Conner Fromknecht 5e27b5022c multi: remove LocalFeatures and GlobalFeatures 2019-11-08 05:32:00 -08:00
Conner Fromknecht 16318c5a41 multi: merge local+global features from remote peer 2019-11-08 05:31:47 -08:00
Conner Fromknecht 6c86075354 peer+server: use feature manager to generate feature vectors 2019-11-08 05:29:29 -08:00
Conner Fromknecht fe566e1755 feature: add new feature pkg to manage feature sets
This commit introduces a feature.Manager, which derives feature vectors
for various contexts within the daemon. The sets can be described via a
staticly compiled format, which makes any runtime adjustments to the
feature sets when the manager is initialized.
2019-11-08 05:29:16 -08:00
Conner Fromknecht 90e36ca04b lnwire/features: add unified Features namespace 2019-11-08 05:28:47 -08:00
Conner Fromknecht 92fb5ac363 Merge pull request #3686 from joostjager/local-apriori
routing: use distinct probability estimation for local channels
2019-11-08 03:32:37 -08:00
Conner Fromknecht 8b5f16387c watchtower/lookout: fix double-hex encoded chainhash 2019-11-05 15:05:20 -08:00
Conner Fromknecht 51627ffe5f server: fix double hex encoded peer string 2019-11-05 15:05:04 -08:00
Conner Fromknecht 52b3d5bbf7 fundingmanager: print hex of pending chan id, use snake case 2019-11-05 15:04:43 -08:00
Conner Fromknecht 0035e8b99d routing/router: fix double hex encoding of target pubkey 2019-11-05 15:04:24 -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
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
Conner Fromknecht 21a40daf58 Merge pull request #3609 from bitromortac/fwdinghistory-msat-amounts
lnd+lnrpc: add msat forwarding amount fields to ForwardingHistory
2019-10-18 09:16:44 +02:00
Conner Fromknecht 93247d0304 Merge pull request #3557 from guggero/loop-sweeper-integration
input+sweep: rework witness type into interface to be used externally
2019-10-16 13:09:03 +02:00
Conner Fromknecht 7408fe51ee Merge pull request #2352 from sangaman/jstype-string
lnrpc: set JS_STRING option for chan_id
2019-10-16 13:02:08 +02:00
Conner Fromknecht dbc0e88584 Merge pull request #3564 from joostjager/htlcswitch-logging
build+htlcswitch+lnwallet: add prefix logger
2019-10-16 13:00:36 +02:00
Conner Fromknecht c10eacaa24 Merge pull request #3532 from guggero/refactor-log-writer
build+lnd: refactor reusable log file rotator code into build package
2019-10-16 12:59:39 +02:00
Conner Fromknecht 122b43b447 build/release: add new release targets
Notably, solaris/amd64 and illumos/amd64 were added in go1.13. The
others were have been supported previously but were not build targets.

After go1.13, nacl/* will no longer be supported and plan9/* is still
considered experiemental. As a result they are omitted.
2019-10-04 14:50:26 -07:00
Conner Fromknecht 6e9560e818 build/release: format+sort build existing targets 2019-10-03 17:31:13 -07:00
Conner Fromknecht acc5104f53 lnrpc+routerrpc: disable custom tlv records via rpc
In order to prevent future unforeseen issues, we are temporarily
disabling the ability to send custom tlv records to the receiver of a
payment. Currently the receiver does not process or expose these
additional fields via rpc or internally, so they are being disabled
until the end-to-end flow is finished and fully validated.
2019-10-03 15:55:45 -07:00
Conner Fromknecht 65a991999d lnwire/features: static_remote_key bits, 10/11 -> 12/13
Final version of spec allocated 12/13 to option_static_remote_key.
2019-10-02 03:33:22 -07:00
Conner Fromknecht 9710134f70 Merge pull request #3566 from wpaulino/wait-until-peer-active
peer+server: wait until peer is active to begin channel opening process
2019-10-01 17:36:32 -07:00
Conner Fromknecht 45114cb819 build: bump to bitcoind 0.18.1 for itests 2019-10-01 16:29:55 -07:00
Conner Fromknecht 1b79414175 server: don't prune manual perm connections 2019-10-01 16:13:35 -07:00
Conner Fromknecht 10d53e61aa Merge pull request #3551 from joostjager/safe-invoice-migration
channeldb: safe invoice migration
2019-09-30 15:48:19 -07:00
Conner Fromknecht a280a4987c peer: resend channel reestablishes without starting chan streams
This prevents the DLP protocol from breaking as a result of the
refactor, since the closing or closed channels won't be included in the
peer's active map.
2019-09-25 12:18:21 -07:00
Conner Fromknecht ced113452d peer: only mark active channels as failed
Also adds similar sanity check for LinkUpdater msgs, so that we don't
process messages for inactive channels.
2019-09-25 12:01:23 -07:00
Conner Fromknecht f33a1a61e6 peer: extract error handling logic 2019-09-25 12:01:11 -07:00
Conner Fromknecht 2df5a36048 peer+lnwire: add LinkUpdater iface and impl on relevant msgs
Removes longstanding TODO to simplify parsing of target chanid.
2019-09-25 12:00:59 -07:00
Conner Fromknecht da1b599d88 Makefile+release: only use -trimpath on release script
Allows lnd to still be compiled with go1.12.x, tho users with go1.13 can
still verify release binaries.
2019-09-19 14:34:38 -07:00
Conner Fromknecht 934b11fdac Merge pull request #3509 from alrs/fix-lnwallet-test-goroutine
lnwallet: fix goroutines in tests
2019-09-19 14:01:45 -07:00
Conner Fromknecht 6585a56581 Merge pull request #3504 from alrs/fix-brontide-test-goroutine
brontide: fix test goroutine
2019-09-19 12:51:33 -07:00
Conner Fromknecht 3276bf2960 htlcswitch/link: remove channel reestablish deadline
Now that the link will remain ineligible until it receives
channel_reestablish from the remote peer, we can remove the channel
reestablish timeout entirely.
2019-09-19 12:47:08 -07:00
Conner Fromknecht 9d6ee2ebd9 htlcswitch/link: restrict EligibleToForward to wait for reestablish
This commit modifies the link's EligibleToForward() method only return
true once the peers have successfully exchanged channel reestablish
messages. This is a preliminary step to increasing the reestablish
timeout, ensuring the switch won't try to forward over links while
we're waiting for the remote peer to resume the connection.
2019-09-19 12:46:56 -07:00
Conner Fromknecht 6dca07577d multi: move active/inactive ntfns from switch to link
Since we will now wait to deliver the event after channel reestablish,
notifying when the link is added to the switch will no longer be
sufficient. Later, we will add receiving reestablish as an additional
requirement for EligibleToForward returning true.

The inactive ntfn is also moved, to ensure that we don't fire inactive
notifications if no corresponding active notification was sent.
2019-09-19 12:46:44 -07:00
Conner Fromknecht 1d41d4d666 multi: move WaitPredicate, WaitNoError, WaitInvariant to lntest/wait 2019-09-19 12:46:29 -07:00
Conner Fromknecht 003441d7e9 build: adding missing unit test dep to go.sum 2019-09-19 12:46:17 -07:00
Conner Fromknecht 7252e175dc lncli+wtclientrpc: remove wtclientrpc build tag, compile by default 2019-09-18 17:26:15 -07:00
Conner Fromknecht cd7610ff41 Makefile: remove linter version from pkg definition 2019-09-18 14:18:14 -07:00
Conner Fromknecht 4e5c4df098 Makefile: remove side-effects to go.mod when installing all deps
This commit applies the same cd /tmp prefix to installations for all
dependencies. It also corrects the previous behavior, which requires the
cd /tmp to be in the same command, and not separate statements.
2019-09-18 14:03:18 -07:00
Conner Fromknecht ed8913f08a Makefile: add verbose output to go get for linter 2019-09-18 14:01:49 -07:00
Conner Fromknecht 697974c9cf Makefile: remove extraneous go install calls for module deps 2019-09-18 14:01:12 -07:00
Conner Fromknecht a8130f0c40 Makefile: remove -u when installing go-acc 2019-09-18 13:43:35 -07:00
Conner Fromknecht 551693e1b8 Merge pull request #3496 from joostjager/fix-incoming-dust
cnct: do not create an action for incoming dust htlcs
2019-09-16 12:31:37 -07:00
Conner Fromknecht 46586e2a4c Merge pull request #3495 from halseth/router-not-starte-deadlock
chainntnfs: start concurrent queues prior to connection
2019-09-16 12:19:54 -07:00
Conner Fromknecht 35d4652d23 Merge pull request #3503 from joostjager/remove-whitespace-linter
build: pin golangci-lint version
2019-09-13 11:25:54 -07:00
Conner Fromknecht 72c5d11a1c Merge pull request #3502 from joostjager/err-returns
multi: fix dropped errors
2019-09-13 11:24:04 -07:00
Conner Fromknecht 2c3ce2a183 Merge pull request #3484 from joostjager/fix-hop-log
htlcswitch/hop: fix logging
2019-09-11 13:37:43 -07:00
Conner Fromknecht 6015567927 htlcswitch/iterator: validate presence/omission of payload types
From BOLT 04:

The writer:
 - MUST include amt_to_forward and outgoing_cltv_value for every node.
 - MUST include short_channel_id for every non-final node.
 - MUST NOT include short_channel_id for the final node.
2019-09-05 09:32:03 -07:00
Conner Fromknecht aefec9b10f tlv: return parsed types from DecodeWithParsedTypes
This commit adds an additional return value to
Stream.DecodeWithParsedTypes, which returns the set of types that were
encountered during decoding. The set will contain all known types that
were decoded, as well as unknown odd types that were ignored.

The rationale for the return value (rather than an internal member) is
so that the stream remains stateless.

This return value can be used by callers during decoding to make
assertions as to whether specific types were included in the stream.
This is need, for example, when parsing onion payloads where certain
fields must be included/omitted depending on the hop type.

The original Decode method would incur the additional performance hit of
needing to track the parsed types, so we can selectively enable this
functionality when a decoder requires it by using a helper which
conditionally tracks the parsed types.
2019-09-05 09:30:37 -07:00
Conner Fromknecht 138b0798f5 htlcswitch/iterator: use hop.Payload constructors 2019-09-05 01:35:24 -07:00
Conner Fromknecht 378e0558c5 htlcswitch/hop: move hop.Exit and hop.Source to hop pkg 2019-09-05 01:35:23 -07:00
Conner Fromknecht fc0e4be4d8 htlcswitch+hop: move ForwardingInfo to hop.ForwaringInfo 2019-09-05 01:35:23 -07:00
Conner Fromknecht 83d2112e8b htlcswitch/hop: move NetworkHop to hop.Network 2019-09-05 01:35:20 -07:00
Conner Fromknecht 947cc50c13 routing/route/route: prevent modification of hop.TLVRecords
Currently the underlying array backing the hop's TLVRecords is modified
when combining custom records with the primitive forwarding info. This
commit uses a fresh slice to prevent modifications from mutating the
hop itself.
2019-09-04 14:14:34 -07:00
Conner Fromknecht 278e10a2fd routing/route/route: omit next_hop_id for final hop
BOLT04 says to omit this field for final hops, but must be present on
all other hops.
2019-09-04 12:05:10 -07:00