Commit Graph
100 Commits
Author SHA1 Message Date
Conner Fromknecht cc18d0ae6b Merge pull request #3824 from cfromknecht/invoice-features-rpc
lnrpc: expose features on rpc invoices
2019-12-12 01:33:48 -08:00
Conner Fromknecht aba49c9a5a rpcserver: populate features on lnrpc invoices
In the process, we also move the feature serialization into the
invoicesrpc package, so that it can be shared between the invoicesrpc
and main rpcserver.
2019-12-12 00:12:51 -08:00
Conner Fromknecht 7446495b6d lnrpc: add features field to invoices 2019-12-12 00:08:18 -08:00
Conner Fromknecht 840476996c zpay32: ensure feature vector is always populated 2019-12-11 17:37:18 -08:00
Conner Fromknecht 1367187454 multi: set invoice feature bits using feature manager 2019-12-10 13:09:52 -08:00
Conner Fromknecht a168f37b9c lnwire+rpcserver: populate feature bits on decodepayreq 2019-12-10 13:09:36 -08:00
Conner Fromknecht 5defa425e1 lnrpc: add feature bits to PayReq 2019-12-10 13:09:17 -08:00
Conner Fromknecht f34239889b lnwire/feature: remove feature bit number from name
The number and the name will be separate on the rpc level, so we remove
the feature bit from the string. Currently this method is unused apart
from maybe in some rare logging instances.
2019-12-10 13:08:59 -08:00
Conner Fromknecht a77e111c52 zpay32: remove unused InvoiceFeatures
Originally the feature namespaces were destined to be split, but this
has changed with the introduction of flat features.
2019-12-10 13:08:40 -08:00
Conner Fromknecht d230cf89b9 Merge pull request #3774 from bhandras/hotfix
lnwire: fixing buffer size and cleaning up uint16/32 conversion
2019-12-05 17:03:16 -08:00
Conner Fromknecht 8b3ee62366 Merge pull request #3794 from cfromknecht/stage-travis
travis: staged builds
2019-12-05 15:34:01 -08:00
Conner Fromknecht d7af7934b8 travis: staged travis builds
This PR introduces staging to our travis pipeline. Currently all
instances perform:

 - compilation of lnd
 - linting
 - compilation and installation of btcd binaries
 - installation of bitcoind binaries

In total this adds about 3 minutes to each of our 5 instances, resulting in
roughly 12 minutes of redundant execution time. Additionally, if if a build
fails to compile or lint we detect this 5 separate times, consuming precious
instances from other builds.

We alleviate this by adding an initial Build phase, which runs a single
instance performing the actions above. This has the benefit of quickly sanity
checking the pr before moving on to the more expensive unit or integration test
suites, and failing faster for common mistakes. It also warms up the build
caches for the Test stage in one fell swoop.

For instance, if 5 people push changes at the same time, they can all get
immediate feedback regarding compilation or linting issues, and potentially
save hours waiting for other people's test to finish or fail before finding out
they had a spelling error. This doesn't alleviate all possible issues, e.g. the
5 instances may already be consumed by test suites, but it does make a sizable
step towards minimizing time-to-failure in common scenarios.
2019-12-05 14:36:01 -08:00
Conner Fromknecht f3398c0c0e Merge pull request #3789 from cfromknecht/coop-close-rpc-status
republish force and coop closes on startup
2019-12-05 10:35:53 -08:00
Conner Fromknecht 969fe440b7 Merge pull request #3788 from cfromknecht/payment-addr
parse and generate bolt 11 invoices w/ payment addrs
2019-12-05 10:29:35 -08:00
Conner Fromknecht abb7f4fa9e lnrpc+rpcserver: add payment_addr field to PayReq 2019-12-05 07:59:47 -08:00
Conner Fromknecht cd27ee7cfc rpcserver+invoicesrpc: set payment addr on new invoices
This commit modifies Lighting.AddInvoice and InvoicesRPC.AddHoldInvoice
to include the node's supported feature bits on the invoice. For now
this only includes the optional TLV Onion Payload bit.
2019-12-05 07:59:31 -08:00
Conner Fromknecht df72097f2d zpay32/invoice: parse payment address as type s 2019-12-05 07:59:17 -08:00
Conner Fromknecht 2bf94fa409 zpay32/invoice: consolidate 32-byte array parsing and encoding logic
This commit also consolidates the existing code duplication in parsing
payment hashes and description hashes into a single, combined method for
parsing 32-byte values. A similar change is made for encoding 32-byte
values.

zpay32/invoice: consolidate 32-byte encoding logic
2019-12-05 07:58:55 -08:00
Conner Fromknecht 4c30f7d5de Merge pull request #3719 from guggero/scb-unconfirmed-channels
chanbackup: encode broadcast height in chan ID for unconfirmed channels
2019-12-04 19:26:24 -08:00
Conner Fromknecht 0610578abb lntest/itest/lnd_test: assert coop close chan status
This commit adds an itest assertion to check that a coop closed
channel's status is properly refelcted in list channels. We also fix a
race condition that prevented the rpc from being externally consistent
by marking the close sooner in the pipeline.
2019-12-04 14:25:29 -08:00
Conner Fromknecht 46990c412c channeldb/channel: allow storing empty closes
This is preparation for the subsequent commit, allowing us to fix a race
condition in the integration test assertions.
2019-12-04 14:25:29 -08:00
Conner Fromknecht d9cf0396b3 peer+chancloser: mark coop broadcasted 2019-12-04 14:25:28 -08:00
Conner Fromknecht b3c28c9cba contractcourt: generalize rebroadcast for force and coop 2019-12-04 14:25:28 -08:00
Conner Fromknecht 1c0dc98a7c channeldb: differentiate force vs coop close 2019-12-04 14:25:28 -08:00
Conner Fromknecht 884c5f0125 Merge pull request #3584 from bjarnemagnussen/ltcd-docker
docker: fix ltcd ports
2019-12-03 13:07:34 -08:00
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 2a6e41236c lnwire/reply_channel_range: assert sorted encodings 2019-11-20 01:57:59 -08:00
Conner Fromknecht 3cc235a349 lnwire/query_short_chan_ids: assert sorted for plain encoding 2019-11-20 01:57:36 -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