Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LND: switch to https://api.lightning.community/#sendpaymentv2 #1590

Closed
kilrau opened this issue Jun 1, 2020 · 12 comments · Fixed by #1971
Closed

LND: switch to https://api.lightning.community/#sendpaymentv2 #1590

kilrau opened this issue Jun 1, 2020 · 12 comments · Fixed by #1971
Assignees
Labels
lightning Lightning network & lnd integration P1 top priority
Milestone

Comments

@kilrau
Copy link
Contributor

kilrau commented Jun 1, 2020

EDIT: lndbtc & lndltc are upgraded to 0.11 and from that perspective we are ready to enable MPP. Question now is if to move to the streaming call sendpaymentv2 since MPP is currently not available in the sync version sendpaymentsync. TBD if it ever will be (see #1590 (comment)).

@kilrau kilrau added the P2 mid priority label Jun 1, 2020
@kilrau kilrau added the lightning Lightning network & lnd integration label Jun 1, 2020
@sangaman
Copy link
Collaborator

sangaman commented Jun 5, 2020

As I understand it for this issue we are waiting for 0.10.1 to be used for lnd in the xud-docker repo.

@kilrau
Copy link
Contributor Author

kilrau commented Jun 5, 2020

And before that lndltc to be upgraded to that version too, yes.

cc @losh11

@losh11
Copy link

losh11 commented Jun 10, 2020

lndltc 0.10.1 release is planned. currently have an alpha running on my computer, just trying to fix a few issues, then will release ASAP

@kilrau
Copy link
Contributor Author

kilrau commented Jun 10, 2020

If you need help with testing -> push the branch and ping us 💪

@kilrau kilrau assigned rsercano and unassigned sangaman Aug 24, 2020
@rsercano
Copy link
Collaborator

rsercano commented Aug 25, 2020

This API uses streaming instead of unary calls we already use, this's the unary call we use; https://api.lightning.community/#sendpaymentsync and there's no unary call for sendpaymentv2

Just to ensure, will we switch to stream calls? Note that since this's async, I'm not sure how to handle this.

@kilrau
Copy link
Contributor Author

kilrau commented Aug 25, 2020

True, didn't see that. We ideally would want to stick with https://api.lightning.community/#sendpaymentsync. Can you check if it supports max_parts? https://api.lightning.community/#sendpaymentsync indicates it doesn't, but maybe the documentation is wrong.

@rsercano
Copy link
Collaborator

@losh11
Copy link

losh11 commented Aug 25, 2020

sendpaymentv2 has no sync call, which is the only version which supports MPP.

@kilrau
Copy link
Contributor Author

kilrau commented Aug 25, 2020

sendpaymentv2 has no sync call, which is the only version which supports MPP.

Is it realistic that MPP will be available in sendpaymentsync at some point or should we switch to sendpaymentv2? @Roasbeef

@Roasbeef
Copy link

Roasbeef commented Aug 26, 2020 via email

@ghost
Copy link

ghost commented Aug 26, 2020

sendpaymentsync was only a workaround as we didn't yet support streaming responses over the REST interface. SendPaymentv2 will be the only endpoint that'll be maintained and extended from now on.

On Tue, Aug 25, 2020 at 11:35 AM Kilian Rausch | zap OpenDEX zap < @.***> wrote: sendpaymentv2 has no sync call, which is the only version which supports MPP. Is it realistic that MPP will be available in sendpaymentsync at some point or should we switch to sendpaymentv2? @Roasbeef https://github.com/Roasbeef — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1590 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHTWLWBQ7M66ER4JWXJM3DSCP75TANCNFSM4NPU4UOA .

@sangaman maybe it's time we decouple SwapClient.sendPayment from returning the preimage? I believe this will also simplify the logic for swaps and align it with how we're sending payments for Connext.

@sangaman
Copy link
Collaborator

maybe it's time we decouple SwapClient.sendPayment from returning the preimage? I believe this will also simplify the logic for swaps and align it with how we're sending payments for Connext.

We could certainly do that but it seems like it may still be easiest to keep it as is and handle the async nature of SendPaymentv2 within LndClient. From our perspective there aren't any intermediary steps we'd need to take between the payment being started and the payment succeeding/failing, unless perhaps we want to log information such as when the HTLC is ready, but even then we could do that within LndClient.

@kilrau kilrau assigned sangaman and unassigned rsercano Aug 27, 2020
@kilrau kilrau added P1 top priority and removed P2 mid priority labels Oct 15, 2020
sangaman added a commit that referenced this issue Oct 30, 2020
This migrates the call we use to send payments with lnd from the
deprecated `SendPaymentSync` to `SendPaymentV2` which allows for multi
path payments, among other improvements. As part of this change, the
lnd proto files have been updated to their v0.11.x versions and the
version of lnd used in simulation tests has been updated to v0.11.1 as
well.

Closes #1590.
sangaman added a commit that referenced this issue Oct 30, 2020
This migrates the call we use to send payments with lnd from the
deprecated `SendPaymentSync` to `SendPaymentV2` which allows for multi
path payments, among other improvements. As part of this change, the
lnd proto files have been updated to their v0.11.x versions and the
version of lnd used in simulation tests has been updated to v0.11.1 as
well.

Closes #1590.
sangaman added a commit that referenced this issue Oct 30, 2020
This migrates the call we use to send payments with lnd from the
deprecated `SendPaymentSync` to `SendPaymentV2` which allows for multi
path payments, among other improvements. As part of this change, the
lnd proto files have been updated to their v0.11.x versions and the
version of lnd used in simulation tests has been updated to v0.11.1 as
well.

Closes #1590.
sangaman added a commit that referenced this issue Oct 30, 2020
This migrates the call we use to send payments with lnd from the
deprecated `SendPaymentSync` to `SendPaymentV2` which allows for multi
path payments, among other improvements. As part of this change, the
lnd proto files have been updated to their v0.11.x versions and the
version of lnd used in simulation tests has been updated to v0.11.1 as
well.

Closes #1590.
sangaman added a commit that referenced this issue Nov 1, 2020
This migrates the call we use to send payments with lnd from the
deprecated `SendPaymentSync` to `SendPaymentV2` which allows for multi
path payments, among other improvements. As part of this change, the
lnd proto files have been updated to their v0.11.x versions and the
version of lnd used in simulation tests has been updated to v0.11.1 as
well.

Closes #1590.
@kilrau kilrau added this to the 1.3.0 milestone Nov 6, 2020
sangaman added a commit that referenced this issue Nov 10, 2020
This migrates the call we use to send payments with lnd from the
deprecated `SendPaymentSync` to `SendPaymentV2` which allows for multi
path payments, among other improvements. As part of this change, the
lnd proto files have been updated to their v0.11.x versions and the
version of lnd used in simulation tests has been updated to v0.11.1 as
well.

Closes #1590.
raladev added a commit that referenced this issue Nov 19, 2020
* feat: removeorder output changed to a more meaningful message (#1526)

* fix(p2p): don't reconnect peers when pool closed (#1965)

This ensures that we don't attempt to reconnect to peers that have
disconnected from us after we have started closing the p2p pool. This
may help prevent scenarios where we unintentionally attempt to
reconnect to peers after shutting down xud.

> Should be tested against [#1668 (comment)](#1668 (comment)) @raladev

re-connection after shutdown is disappeared, but my xud still can not be gracefully  terminated, it waits something:

```
28/10/2020 05:17:43.164 [CONNEXT] trace: sending request to /balance/0x69C3d485623bA3f382Fc0FB6756c4574d43C1618
^C28/10/2020 05:17:44.087 [GLOBAL] info: XUD is shutting down
28/10/2020 05:17:44.088 [LND-BTC] info: new status: Disconnected
28/10/2020 05:17:44.089 [LND-LTC] info: new status: Disconnected
28/10/2020 05:17:44.090 [CONNEXT] info: new status: Disconnected
28/10/2020 05:17:44.093 [P2P] debug: Peer 03ece33a30db1dbce4b62fa96a5e9541138a24997ef5672eebed2d332270e39542 (OzoneYellow): closing socket. reason: Shutdown
28/10/2020 05:17:44.095 [HTTP] info: http server has closed
28/10/2020 05:17:44.096 [RPC] info: gRPC server completed shutdown
28/10/2020 05:17:44.097 [P2P] trace: Sent Disconnecting packet to 03ece33a30db1dbce4b62fa96a5e9541138a24997ef5672eebed2d332270e39542 (OzoneYellow): "{\"body\":{\"reason\":9},\"header\":{\"id\":\"95133be0-1917-11eb-b75b-73d0f0278756\"}}"
28/10/2020 05:17:44.109 [ORDERBOOK] debug: removed all orders for peer 03ece33a30db1dbce4b62fa96a5e9541138a24997ef5672eebed2d332270e39542 (OzoneYellow)
28/10/2020 05:17:44.118 [GLOBAL] info: XUD shutdown gracefully
```

* feat(lnd): change gRPC client options

* fix(connext): not enough balance for closechannel (#1963)

This introduces better error handling for Connext when using
`closeChannel` to remove funds from a Connext channel and specifying an
amount to remove that is greater than the available balance.

* feat: reserved capacity checks on PlaceOrder (#1949)

This rejects orders that would put our total reserved balance over our
total capacity for either the outbound or inbound currency. The sum of
the inbound & outbound amounts for a newly placed order are added to
the amounts reserved by open orders, and if either of these amounts
exceed the corresponding capacity then the request to place the order is
rejected.

An exception to this are inbound limits for Connext currencies, since we
have the ability to dynamically request additional inbound collateral
via our "lazy collateral" approach.

It is still possible for market orders to cause our open orders to
exceed our capacity. This is a difficult problem to avoid entirely, as
the price that market orders will execute at is unknown until the
execution is complete. Even if we simulate the matching routine, we
won't know which matches will succeed until we attempt a swap.

Instead, we generously assume that market orders will execute at the
best quoted price for purposes of these capacity checks. For users that
simultaneously place limit orders and market orders for the same
currencies, it should be made clear that market orders may use up their
available balance needed for their limit orders to succeed.

Closes #1947.

* fix(cli): openchannel assertion error for string amount (#1950)

Fixes #1643.

* feat(swapclient): auto init wallets on xud unlock (#1973)

This adds a new feature to xud to automatically attempt to create a
wallet for any new swap client configured after an xud node has been
created. Effectively this only changes the behavior for lnd clients, as
this is already the existing behavior for Connext. The process for
initializing has now been standardized instead of the ad hoc approach
used previously.

If xud tries to unlock an lnd node and gets an error message indicating
that the wallet has not been created, then it will generate a client &
currency specific seed mnemonic using seedutil and call `InitWallet`
with that seed and the existing xud password, such that the wallet
funds and node identity for the new lnd client can be unlocked and
restored along with the rest of lnd.

Closes #1929.

* feat(rpc): runtime addcurrency for lnd & connext (#1746)

Co-authored-by: Le Premier Homme <[email protected]>

* refactor(rpc): rename reserved TradingLimits fields

This renames the `reservedOutbound` and `reservedInbound` fields on the
`TradingLimits` call to `reservedSell` and `reservedBuy` respectively.

* fix(rpc): no success if no channels to close (#1689) (#1942)

Co-authored-by: rsercano <[email protected]>
Co-authored-by: Daniel McNally <[email protected]>

* fix: tls certificate check on startup (#1510)

* fix: alias missing in streamorders (#1725) (#1962)

* fix(lnd): handling hold invoice check errors (#1969)

This adds better error handling for when the test calls to verify lnd
hold invoices are available fail due to connectivity reasons. Previously
any error that occurred at this step would cause us to set lnd's status
to `NoHoldInvoiceSupport` including connection issues. There was also a
bug that caused us to try to set the status to connected even when a
hold invoice status check failed.

This could result in the unusual behavior of status going to
`Disconnected` upon a call failing due to the grpc `UNAVAILABLE` error
status, then being set to `NoHoldInvoiceSupport` and then to
`ConnectionVerified`. Now we only set `NoHoldInvoiceSupport` when the
test calls fail for a reason other than `UNAVAILABLE`, and we only set
the status to `ConnectionVerified` when the hold invoice calls succeed.

Closes #1968.

* feat(lnd): SendPaymentV2

This migrates the call we use to send payments with lnd from the
deprecated `SendPaymentSync` to `SendPaymentV2` which allows for multi
path payments, among other improvements. As part of this change, the
lnd proto files have been updated to their v0.11.x versions and the
version of lnd used in simulation tests has been updated to v0.11.1 as
well.

Closes #1590.

* Revert "feat: removeorder output changed to a more meaningful message (#1526)"

* fix: use regtest instead of regnet arg

This fixes a bug where the xud flag to set the network was incorrectly
configured as `regnet` when it should be `regtest` to match what xud
expects.

* fix(lnd): don't calculate negative capacities

This fixes a bug in the logic for calculating the inbound & outbound
amount/capacity totals. We subtract the channel reserve amounts from the
balances when determining how large a payment the channel could support,
however we should not end up with a negative number.

* feat: new grpc call for subscribring alerts such as low balance (#864)

* fix: changes removeorder output to a more meaningful message (#1526) (#1986)

Co-authored-by: rsercano <[email protected]>
Co-authored-by: Daniel McNally <[email protected]>
Co-authored-by: Karl Ranna <[email protected]>
Co-authored-by: Le Premier Homme <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lightning Lightning network & lnd integration P1 top priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants