Commit Graph

8729 Commits

Author SHA1 Message Date
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
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
Olaoluwa Osuntokun
22e1f006b1
Merge pull request #3870 from Septem151/rpc-autopilot-fix
Fix typo in "query" rpc for autopilot.
2020-01-02 16:03:05 -08:00
Olaoluwa Osuntokun
5ade9abe29
Merge pull request #3777 from guggero/shared-key
signrpc: add DeriveSharedKey
2020-01-02 16:02:47 -08:00
Olaoluwa Osuntokun
f289a39c1a
Merge pull request #3795 from joostjager/keysend
lncli+invoices: experimental key send mode
2019-12-24 17:38:46 -06:00
Joost Jager
4273bc0ba2
lntest/itest: add key send test 2019-12-23 21:51:27 +01:00
Joost Jager
bb1e2afc9f
lntest/itest: move single hop invoice test to separate file 2019-12-23 21:51:25 +01:00
Joost Jager
b1206f67c2
lncli: send key
Extend lncli with a flag that indicates the intention to send
a spontaneous payment. lncli will generate a preimage/hash combination
and send the preimage as a custom record to the recipient.
2019-12-23 21:51:23 +01:00
Joost Jager
c08865f4ae
lnrpc/invoicesrpc: add is_key_send flag to rpc invoice 2019-12-23 21:51:21 +01:00
Joost Jager
1d5844c196
invoices: jit insert key send invoices
This commit adds handling code for the key send custom record. If this
record is present and its hash matches the payment hash, invoice
registry will insert a new invoice into the database "just in time". The
subsequent settle flow is unchanged. The newly inserted invoice is
picked up and settled. Notifications will be broadcast as usual.
2019-12-23 21:51:19 +01:00
Joost Jager
202b7c26a7
invoices: move lock acquisition down
Move in separate commit to make next commit more readable.
2019-12-23 21:51:17 +01:00
Joost Jager
6063dc31fc
lnrpc/invoicesrpc: support empty payment request fields
Prepares for spontaneous key send payments that do not have a payment
request.
2019-12-23 21:51:15 +01:00
Joost Jager
15eedd2b1a
lncli: remove debug send
Debug send has been removed some time ago. This is a left over.
2019-12-23 21:51:13 +01:00
Joost Jager
af1b8a549d
channeldb: update payment request comment
This field isn't optional. It was introduced in
5ed31b1030176374d4184fee0b80ae7679e0e355 which was part of release
0.4.0. This release contained breaking database changes, so it is safe
to assume that from there on the field is always populated.

If there would still be empty payment request fields in the wild, users
would also experience issues with ListInvoices. ListInvoices decodes the
payment request.
2019-12-23 21:51:11 +01:00
Joost Jager
c89f0dc7c1
invoices/test: lower test delay
Previously 5 seconds was used, which made the otherwise fast registry
tests relatively slow.
2019-12-23 21:51:10 +01:00
Olaoluwa Osuntokun
7eacc40419
Merge pull request #3722 from Roasbeef/external-funding-rpc
lnrpc+lnwallet+funding: implement new RPCs to enable external channel funding
2019-12-23 14:41:46 -06:00
Olaoluwa Osuntokun
e0d9bbfbc4
Merge pull request #3873 from matheusdtech/reenable-tests
Re-enable TestLightningWallet tests
2019-12-23 13:23:29 -06:00
Matheus Degiovani
5dffa7da1c lnwallet: Re-enable tests
Tests were erroneously disabled in commit b1940d67.
2019-12-23 10:32:03 -03:00
Matheus Degiovani
02d616d9b7 lnwallet: Fix external funding test 2019-12-23 10:31:03 -03:00
Carson Mullins
74d48510c8
Fix typo in "query" rpc for autopilot. 2019-12-22 20:19:36 -06:00
Olaoluwa Osuntokun
3de3ec8008
lntest/itest: add new test for external chan point funding 2019-12-20 19:09:56 -08:00
Olaoluwa Osuntokun
be4db0ebca
lntest: add optional FundingShim field to OpenChannelParams 2019-12-20 19:09:48 -08:00
Olaoluwa Osuntokun
bc176b5aa3
rpc+lnwallet: implement new FundingStateStep RPC method
In this commit, we implement the currently defined transition methods
for the new `FundingStateStep` method. At this point, we're now able to
serve the "responder" of the externally initiated channel funding flow
by being able to register and cancel a funding flow according to its
expected pending channel ID.
2019-12-20 19:09:44 -08:00
Olaoluwa Osuntokun
91bd56dbd1
funding+rpc: expand specified chan point shim into a canned assembler
In this commit, we update the `OpenChannel` method to observe the new
`funding_shim` field in the main open channel request. If this is
specified, and is a channel point shim, then we'll create a custom
`chanfunding.Assembler` for the wallet to use in place of the regular
funding workflow.

With this commit, the "initiator" of an external funding flow can now
delegate the remainder of the channel funding workflow to lnd.
2019-12-20 19:09:41 -08:00
Olaoluwa Osuntokun
3eed38d602
lnrpc: add ability to provide chan point shims for funding, new funding modifiers
In this commit, we start to expose some of the new external funding
functionality over the RPC interface.

First, we add a new `funding_shim` field to the regular `OpenChannel`
method. This can be used by a caller to express that certain parameters
of the funding flow have already been negotiated outside the protocol,
and should be used instead. For example, a shim can be provided to use a
particular key for the commitment key (ideally cold) rather than use one
this is generated by the wallet as normal, or signal that signing will
be carried out in an interactive manner (PSBT based).

Next, we add a brand new method: `FundingStateStep`. FundingStateStep is
an advanced funding related call that allows the caller to either
execute some preparatory steps for a funding workflow, or manually
progress a funding workflow. The primary way a funding flow is
identified is via its pending channel ID. As an example, this method can
be used to specify that we're expecting a funding flow for a particular
pending channel ID, for which we need to use specific parameters.
Alternatively, this can be used to interactively drive PSBT signing for
funding for partially complete funding transactions.

The new transition methods (funding state machine modifiers) in this
commit allow a party to register a funding intent that should be used
for a specified incoming pending channel ID. The "responder" to the
external channel flow should use this to prep lnd to be able to handle
the channel flow properly.
2019-12-20 19:09:38 -08:00
Conner Fromknecht
72a49d486a
Merge pull request #3647 from cfromknecht/hex-jsonpb
build+lncli: default to hex encoding for byte slices
2019-12-20 18:23:52 -08:00
Olaoluwa Osuntokun
c9f39638b0
Merge pull request #3857 from kiwiidb/master
fix: incomplete comment about minFinalCLTVExpiry
2019-12-20 17:05:28 -08:00
Wilmer Paulino
9216ef2cd7
Merge pull request #3855 from cfromknecht/sorted-policies
routing/pathfind_test: construct sorted edge policies
2019-12-20 10:27:28 -08:00
kiwiidb
af1ff291a7 Merge branch 'master' of github.com:lightningnetwork/lnd 2019-12-20 15:00:20 +01:00
Joost Jager
6e0cfe579b
Merge pull request #3841 from joostjager/check-max-onion-size
routing: check max routing info size
2019-12-20 14:42:47 +01:00
Joost Jager
e3b9ed5cd8
Merge pull request #3863 from joostjager/fix-result-interpretation
routing: fix gap in result interpretation
2019-12-20 14:42:19 +01:00
Joost Jager
8d0205e9e4
Merge pull request #3831 from carlaKC/invoices-surfaceupdateresult
Add MPPTimeout ResolutionResult and expose to caller
2019-12-20 14:41:37 +01:00
carla
25a8773736
routing: interpret mpp timeout failues
This commit adds success mission control
results for all hops along the route in
a mpp timeout and takes no action for
the final hop along the route. This is a
temporary measure to prevent the default
logic from penalizing the final node while
we decide how to penalize mpp timeouts.
2019-12-20 13:02:30 +02:00
carla
b6f546503a
routerrpc: add MppTimeout code to failures 2019-12-20 13:02:19 +02:00
carla
e0c86f1e71
htlcswitch+invoices: fail mpp timeouts with FailMPPTimeout
This commit adds a getResolutionFailure function
which returns an appropriate wire failure based
on the outcome of a htlc resolution. It also updates
 the MissionControlStore test to ensure that lnd
can handle failures which occur due to mpp timeout.
2019-12-20 13:02:02 +02:00
carla
1d3bb5aed6
lnwire: add FailMPPTimeout message 2019-12-20 13:01:41 +02:00
carla
d2e395d5f2
multi: replace errInvoiceNotFound with resolution result
This commit moves handling of invoice not found
errors into NotifyExitHopHtlc and exposes a
resolution result to the calling functions. The
intention of this change is to make calling
functions as naive of the invoice registry's
mechanics as possible.

When NotifyExitHopHtlc is called and an invoice
is not found, calling functions can take action
based on the HtlcResolution's InvoiceNotFound
outcome rather than having to add a special error
check on every call to handle the error.
2019-12-20 13:01:15 +02:00
carla
7b5dda0417
invoices: add resolution result to htlcResolution
This commit adds the resolution result obtained
while updating an invoice in the registry to
htlcResolution. The field can be used by calling
functions to determine the outcome of the
update and act appropriately.
2019-12-20 13:00:53 +02:00
carla
273cd84355
invoices+contractcourt: add HtlcResolution constructor
This commit adds a constructor for HtlcResolution creation
to enforce provision of all relevant values when an
event is created. A custom construstor which also takes
a preimage is added for settle events.
2019-12-20 13:00:24 +02:00
carla
ebfbc48973
link+contractcourt: rename processHodlEvent to processHtlcResolution 2019-12-20 12:59:56 +02:00
carla
6464f0dda0
invoices: rename event to resolution in tests 2019-12-20 12:59:33 +02:00
carla
2c44afa3a7
contractcourt: rename mock notifyEvent to notifyResolution 2019-12-20 12:59:14 +02:00
carla
2c1eb17192
mutli: rename HodlEvent to HtlcResolution
This commit renames HodlEvent to HtlcResolution
to better reflect the fact that the struct is
only used for htlc settles and cancels, and that
it is not specifically used for hodl invoices.
2019-12-20 12:58:07 +02:00
carla
db85c51b77
invoices: export and rename update result
This commit exports UpdateResult so that
calling functions can interpret the outcome
of an invoice update. This is useful for
determining the wire failure required
(fail invalid details or mpp_timeout once
implemented) and for notifying specific
htlc failure details. The enum is renamed
to ResolutionResult.
2019-12-20 12:25:07 +02:00
Joost Jager
c84e57a522
routing: remove unnecessary newline 2019-12-20 11:00:07 +01:00