Commit Graph

9139 Commits

Author SHA1 Message Date
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
Wilmer Paulino
c4723ce3db
lnwire: add LastBlockHeight method to QueryChannelRange 2020-01-06 14:00:16 -08:00
Wilmer Paulino
c7c0853531
discovery: cover requested range in ReplyChannelRange messages
In order to properly adhere to the spec, when handling a
QueryChannelRange message, we must reply with a series of
ReplyChannelRange messages, that when consumed together cover the
entirety of the block range requested.
2020-01-06 14:00:15 -08:00
Wilmer Paulino
1f781ea431
discovery: use inclusive range in FilterChannelRange
FilterChannelRange takes an inclusive range, so it was possible for us
to return channels for an additional block that was not requested.
2020-01-06 14:00:14 -08:00
Olaoluwa Osuntokun
66ff2c1e7a
Merge pull request #3890 from guggero/custom-shared-key
signrpc: derive custom shared key
2020-01-06 13:42:14 -08:00
Joost Jager
41c207e247
lnwallet/test: describe existing bug after restart with dangling remote updates 2020-01-06 15:30:23 +01:00
Joost Jager
b3bd470962
lnwallet: restore missing field in local log update
When restoring an htlc fulfill update from disk, the payment hash wasn't
restored previously.
2020-01-06 15:13:21 +01:00
Oliver Gugger
4f98642b5e
signrpc: derive custom shared key
With this commit we add the ability to create a shared DH key by using
a custom node private key instead of the node's identity private key.
If no key locator is specified the node's identity private key will be
used as a fallback.
2020-01-06 14:53:32 +01:00
Johan T. Halseth
9c3218c51e
lnwallet/channel: reuse derived SingleTweak on local force close
When creating the keyring, the tweak is already calculated in the remote
commitment case. We add the calculation also for our own commitment, so
we can use it in all cases without deriving the tweak.
2020-01-06 12:08:29 +01:00
Johan T. Halseth
3711597fef
input: remove duplicate commit weight constant 2020-01-06 12:08:25 +01:00
Johan T. Halseth
a56ed72bd7
lnwallet: use channel type to derive remote script
Based on the current channel type, we derive the script used for the
to_remote output. Currently only the unencumbered p2wkh type is used,
but that will change with upcoming channel types.
2020-01-06 12:08:19 +01:00
Johan T. Halseth
9b5809a884
input: update SignDescriptor doc to note only segwit is supported
Also update the WitnessScript doc to note it should be set also for
p2wkh.
2020-01-06 12:08:14 +01:00
Johan T. Halseth
f92c7a3af0
lnwallet: nil single tweak when creating keyring
To make the channel state machine less concerned about the type of
commitment, we nil the local tweak when creating the keyring, depending
on the commitment type.
2020-01-06 12:08:09 +01:00
Johan T. Halseth
5e3718a1b5
lnwallet: use channel type to derive keys
We abstract away how keys are generated for the different channel types
types (currently tweak(less)).

Intention is that more of the logic that is unique for each commitment
type lives in commitment.go, making the channel state machine oblivious
to the keys and outputs being created on the commitment tx for a given
channel state.
2020-01-06 12:08:05 +01:00
Johan T. Halseth
4fde31229c
lnwallet: rename DelayKey->ToLocalKey, NoDelayKey->ToRemoteKey
Since both parties are going to have their ouputs delayed, we move way
from the DelayKey naming, and instead use ToLocalKey and ToRemoteKey.
2020-01-06 12:08:01 +01:00
Johan T. Halseth
7b9c54996b
lnwallet/commitment: clarify keyring key ownership 2020-01-06 12:07:56 +01:00