Commit Graph

9004 Commits

Author SHA1 Message Date
carla
f430fd50c5
htlcswitch: use LinkError for internal errors
Update the ChannelLink interface to specifically
return the LinkError struct. This error implements
the ClearTextError interface, so will be picked
up as a routing realted error by the router.

With LinkErrors implemented, the switch now
returns a LinkError for all failures on our
incoming/outgoing link and ForwardingError when
the failure occurs down the line.
2020-01-14 15:21:15 +02:00
carla
b5a2d75465
htlcswitch+routing: type check on ClearTextError
Update the type check used for checking local payment
failures to check on the ClearTextError interface rather
than on the ForwardingError type. This change prepares
for splitting payment errors up into Link and Forwarding
errors.
2020-01-14 15:07:42 +02:00
carla
6a83b06ab7
htlcswitch: add LinkError implementation of ClearTextError
This change introduces a LinkError implementation
of the ClearTextError interface. This error is intended
to represent failures which occur on our incoming and
outgoing link when sending, receiving and forwarding
htlcs. Paired with ForwardingError, which is represents
failures that did not occur at our node, this error
covers all non-opaque errors that the switch experiences.
2020-01-14 15:07:41 +02:00
carla
102f9b003f
htlcswitch: add ClearTextError interface
This commit adds a ClearTextError interface
which is implemented by non-opaque errors that
we know the underlying wire failure message for.
This interface is implemented by ForwardingErrors,
because we can fully decrypt the onion blob to
obtain the underlying failure reason. This interface
will also be implemented by errors which originate
at our node in following commits, because we know
the failure reason when we fail the htlc.

The lnwire interface is un-embedded in the
ForwardingError struct in favour of implementing
this interface. This change is made to protect
against accidental passing of a ForwardingError
to the wire, where the embedded FailureMessage
interface will present as wire failure but
will not serialize properly.
2020-01-14 15:07:41 +02:00
carla
6f0a342f92
htlcswitch: add ForwardingError constructor
Add a constructor for the creation of forwarding errors.
A special constructor is added for the case where we have
an unknown wire failure, and must set a nil failure message.
2020-01-14 15:07:29 +02:00
Joost Jager
d978b55701
lncli: add custom data payment flag 2020-01-14 13:01:45 +01:00
Joost Jager
81bf6e15b3
routing+lnrpc: add missing query routes parameters 2020-01-14 11:21:31 +01:00
Joost Jager
9c577f3f57
routing: extract route hint conversion 2020-01-14 11:21:29 +01:00
Johan T. Halseth
daa08be62a
Merge pull request #3907 from halseth/mobile-walletunlocker-tls
[mobile] Set walletunlocker TLS credentials
2020-01-14 10:30:02 +01:00
Johan T. Halseth
56230f5de2
mobile: add note about using lnddir
On both Android and iOS (when not using a simulator) the application
procees doesn't have write permissions to the default lnd directory.
This commit adds a note about using the app directory given by the used
platform.
2020-01-14 09:30:09 +01:00
Johan T. Halseth
f5a9813304
mobile: add TLS options to wallet unlocker listener
The wallet unlocker service also requires the TLS certificates to be
added, but this was not set. This commit sets the options similar to
what is done for the regular RPC server.
2020-01-14 09:30:09 +01:00
Johan T. Halseth
a870ed5fb7
lnd: add WalletUnlockerAuthOptions
Similar to what was done for the regular RPC server, we add auth dial
options for the wallet unlocker, as it also requires TLS now.
2020-01-14 09:30:09 +01:00
Olaoluwa Osuntokun
a0639c234f
Merge pull request #3887 from bhandras/channeldb_cleanup
channeldb: remove FetchAllInvoices which was test only and unused
2020-01-13 23:16:58 -08:00
Olaoluwa Osuntokun
ec70347b8d
Merge pull request #3897 from cfromknecht/cleanup-pathfind-tests
routing/pathfind_test: use ctx in recent tests
2020-01-13 22:13:10 -08:00
Olaoluwa Osuntokun
91e796aed8
Merge pull request #3903 from joostjager/keysend-no-spam
invoices: streamline key send cltv delta picking and validation
2020-01-13 22:12:25 -08:00
Bastien Teinturier
17200afc57
lnwire: explicitly handle empty list when encoding short chan IDs
Before this commit, both writing and reading an encoded empty set of
short channel IDs from the wire would fail. Prior to this commit, we
treated decoding an empty set as a caller error, and failed to write out
the zlib encoding of an empty set in a way that us and the other
implementations were able to read.

To fix this, rather than giving zlib an empty buffer to write out (which
results in an encoding with the zlib header data and the rest), we just
write a blank slice. When decoding, if we have an empty query body, then
we'll return a `nil` slice.

With the above changes, we'll now always write out an empty short
channel ID set as:
```
0001 (1 byte follows) || <encoding_type>
```

A new test has also been added to exercise this case for both known
encoding types.
2020-01-13 20:26:55 -08:00
Johan T. Halseth
dae5dddfd2
mobile: trim arg spaces before comparison
Since spaces where trimmed only after checking for empty strings, an
empty flag '-- ' would be passed along to lnd. Intead we trim first to
properly ingore such flags.
2020-01-13 13:25:14 +01:00
Olaoluwa Osuntokun
83ff6a59d4
Merge pull request #3899 from cfromknecht/improve-last-hop-help
lncli: improve last_hop help message
2020-01-10 14:49:06 -08:00
Joost Jager
d3fa9767a9
rpc: use more sensible final cltv delta default when sending payments 2020-01-10 21:35:34 +01:00
Joost Jager
59a7a9d308
invoices: pre-check key send expiry 2020-01-10 21:35:14 +01:00
Oliver Gugger
0ce2d6f523
Merge pull request #2699 from yancyribbens/docker-compose-up
docker-compose up
2020-01-10 09:56:21 +01:00
Conner Fromknecht
b3f2a94c3b
lncli: improve last_hop help message
Clarifies that last_hop is not the destination, but the penultimate node
in the path, i.e. the last intermediary.
2020-01-09 17:57:52 -08:00
Conner Fromknecht
32284ef1f1
routing/pathfind_test: use ctx in recent tests
Modifies TestMissingFeatureDep and TestDestPaymentAddr to use the test
ctx directly instead of generating a closure and using local state to
modify restrictions.
2020-01-09 13:53:45 -08:00
Joost Jager
280611ab6e
sweep+walletrpc+lncli: report requested fee preference for pending sweeps
Previously only the fee rate used for the last sweep (the sweep bucket
average) was reported. This commit adds the request fee preference to
the report, which is used to select a bucket and the sweep tx fee rate.
2020-01-09 14:56:08 +01:00
Conner Fromknecht
6c8c99dae9
Merge pull request #3893 from cfromknecht/pathfind-ignore-required-features
routing: ignore unknown required features in pathfinding
2020-01-08 14:13:04 -08:00
Conner Fromknecht
2510ec00f5
watchtower/wtwire/init: use feature.ValidateRequired
This allows us to remove the custom error type originally implemented
for this purpose.
2020-01-08 12:26:00 -08:00
Conner Fromknecht
0f9023256e
peer: use feature.ValidateRequired, cleanup error msgs 2020-01-08 12:25:41 -08:00
Conner Fromknecht
b9b66419ff
zpay32/invoice: remove unknown required fbit check from decode
This commit removes the unknown required feature bit check from the
invoice decoding logic. This allows greater utility to users of the
decodepayreq rpc since it can provide inspection of otherwise invalid
invoices. In the prior commit, this check moved into our path finding
logic, so invalid features taken from an invoice will instead cause a
failure when attempting to pay.
2020-01-08 12:25:21 -08:00
Conner Fromknecht
c7a241fc59
routing/pathfind: ignore unknown required features
This commit brings us inline with recent modifications to the spec, that
say we shouldn't pay nodes whose feature vectors signal unknown required
features, and also that we shouldn't route through nodes signaling
unknown required features.

Currently we assert that invoices don't have such features during
decoding, but now that users can specify feature vectors via the rpc
interface, it makes sense to perform this check deeper in call stack.
This will also allow us to remove the check from decoding entirely,
making decodepayreq more useful for debugging.
2020-01-08 12:25:00 -08:00
Conner Fromknecht
f9a1acfbe4
feature/required: add ValidateRequired method
This wraps the raw UnknownRequiredFeatures method and returns a proper
error type to enable more exact testing.
2020-01-08 12:24:37 -08:00
Joost Jager
10f561dbbd
Merge pull request #3894 from joostjager/bump-version
build: bump version to 0.9.0-beta
2020-01-08 20:56:15 +01:00
Andras Banki-Horvath
8af5d8bc73 channeldb: remove unused, test only FetchAllInvoices function
This commit removes channeldb.FetchAllInvoices and changes tests such
that expectation sets are prepared in the test case instead of selected
from the DB.
2020-01-08 16:51:51 +01:00
Andras Banki-Horvath
4136b18e3d channeldb: remove time.Now() from tests 2020-01-08 16:51:51 +01:00
Andras Banki-Horvath
ec6c0689ef channeldb: fix channeldb.InvoiceHTLC deep copy
This commit fixes deep copy of chaneldb.InvoiceHTLC, where previously
the map holding the custom record set wasn't properly copied.
2020-01-08 16:51:51 +01:00
Joost Jager
c45b841fc0
build: bump version to 0.9.0-beta 2020-01-08 11:35:00 +01:00
Olaoluwa Osuntokun
658803f51c
Merge pull request #3891 from Roasbeef/onion-random-padding
routing: use updated sphinx.NewOnionPacket method
2020-01-07 16:59:19 -08:00
Olaoluwa Osuntokun
b8f6a550a9
Merge pull request #3836 from wpaulino/interpret-query-channel-range
discovery: use block ranges from ReplyChannelRange to determine end marker
2020-01-07 16:52:48 -08:00
Olaoluwa Osuntokun
830d88a25c
Merge pull request #3886 from joostjager/release-checks
build: add version checks to release script
2020-01-07 16:18:18 -08:00
Olaoluwa Osuntokun
128be259a7
routing: use updated sphinx.NewOnionPacket method
In this commit, we update the routing package to use the new
`sphinx.NewOnionPacket` method. The new version of this method allows us
to specify _how_ the packet should be filled before it's used to create
a mix-header. This isn't a fundamental change (totally backwards
compatible), instead it plugs a privacy leak that may have revealed to
the destination how long the true route was.
2020-01-07 16:11:39 -08:00
Olaoluwa Osuntokun
e96e011520
build: update to latest lightning-onion version 2020-01-07 16:11:33 -08:00
Carla Kirk-Cohen
4a0ccc927a
Merge pull request #3889 from carlaKC/chanfitness-startonlineevent
chanfitness: Bugfix save initial peer online event
2020-01-07 20:30:10 +02:00
carla
384c6aa1f1
chanfitness: save initial online event for channels with online peers
This commit adds an initial peer online event for channels
that have peers that are online when they are created. This
addresses a race between the peer coming online and an
existing channel being added to the event store; if the
peer comes online first, the existing channel will not have
its initial online event added.
2020-01-07 16:35:23 +02:00
Johan T. Halseth
3aca9d24b8
Merge pull request #3829 from halseth/pluggable-commitments-lnwallet
Pluggable commitments
2020-01-07 09:58:12 +01:00
Olaoluwa Osuntokun
08ebefa8a3
Merge pull request #3884 from bhandras/hotfix
routing: clean up locking on topology change
2020-01-06 18:00:38 -08:00
Olaoluwa Osuntokun
a0c5d965a3
Merge pull request #3882 from philippgille/feature/fix-unclear-bools-in-config
config: Make bools in sample-lnd.conf consistent
2020-01-06 17:59:44 -08:00
Olaoluwa Osuntokun
79948ebe1c
Merge pull request #3854 from matheusdtech/fix-hn-goroutine-leak
lntest: Don't leak node's grpc conn
2020-01-06 17:55:41 -08:00
Olaoluwa Osuntokun
aab956471d
Merge pull request #3846 from guggero/lntest-node-config
itest: make harnesses usable in external projects
2020-01-06 17:52:16 -08:00
Wilmer Paulino
9a7f66f2f7
peer: modify ReplyChannelRange log message
The message now shows the block range the reply spans, which is a lot
more useful.
2020-01-06 14:03:19 -08:00
Wilmer Paulino
1bacdfb41e
discovery: interpret block range from ReplyChannelRange messages
We move from our legacy way of interpreting ReplyChannelRange messages
which was incorrect. Previously, we'd rely on the Complete field of the
ReplyChannelRange message to determine when our peer had sent all of
their replies. Now, we properly adhere to the specification by
interpreting the block ranges of these messages as intended.

Due to the large number of nodes deployed with the previous method, we
still maintain and detect when we are communicating with them, such that
we are still able to sync with them for backwards compatibility.
2020-01-06 14:03:13 -08:00
Wilmer Paulino
d688e13d35
discovery: remove unnecessary test check
It's not possible to send another reply once all replies have been sent
without another request. The purpose of the check is also done within
another test, TestGossipSyncerReplyChanRangeQueryNoNewChans, so it can
be removed from here.
2020-01-06 14:02:31 -08:00