Skip to content

multi: Remove endpoints sendpayment, sendtoroute, sendtoroutesync, and sendpaymentsync #8348

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 26 additions & 29 deletions docs/grpc/c#.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ var channel = GrpcChannel.ForAddress(
HttpHandler = httpClientHandler,
});
var client = new Lnrpc.Lightning.LightningClient(channel);
var routerClient = new Routerrpc.Router.RouterClient(channel);
```

### Examples
Expand Down Expand Up @@ -132,45 +133,41 @@ $ lncli sendpayment --pay_req=<PAY_REQ>

Your console should now display the details of the recently satisfied invoice.

#### Bidirectional-streaming RPC
#### Server-streaming RPC

```cs
using (var call = client.SendPayment())
{
var responseReaderTask = Task.Run(async () =>
{
while (await call.ResponseStream.MoveNext())
{
var payment = call.ResponseStream.Current;
Console.WriteLine(payment.ToString());
}
});
string destHex = "<THE_RECEIVER_NODE_IDENTITY_PUBLIC_KEY_IN_HEX>";
byte[] destBytes = Convert.FromHexString(destHex);

foreach (SendRequest sendRequest in SendPayment())
{
await call.RequestStream.WriteAsync(sendRequest);
}
await call.RequestStream.CompleteAsync();
await responseReaderTask;
}
int amount = 100;

string paymentHashHex = "<THE_PAYMENT_HASH_IN_HEX>";
byte[] paymentHashBytes = Convert.FromHexString(paymentHashHex);

IEnumerable<SendRequest> SendPayment()
int finalCltvDelta = <THE_FINAL_CLTV_DELTA_AS_INTEGER>;

string paymentAddressHex = "<THE_PAYMENT_ADDRESS_IN_HEX>";
byte[] paymentAddressBytes = Convert.FromHexString(paymentAddressHex);

var request = new SendPaymentRequest
{
Dest = Google.Protobuf.ByteString.CopyFrom(destBytes),
Amt = amount,
PaymentHash = Google.Protobuf.ByteString.CopyFrom(paymentHashBytes),
FinalCltvDelta = finalCltvDelta,
PaymentAddr = Google.Protobuf.ByteString.CopyFrom(paymentAddressBytes)
};

using (var call = routerClient.SendPayment(request))
{
while (true)
while (await call.ResponseStream.MoveNext())
{
SendRequest req = new SendRequest() {
DestString = <DEST_PUB_KEY>,
Amt = 100,
PaymentHashString = <R_HASH>,
FinalCltvDelta = 144
};
yield return req;
System.Threading.Thread.Sleep(2000);
var payment = call.ResponseStream.Current;
Console.WriteLine(payment.ToString());
}
}
```
This example will send a payment of 100 satoshis every 2 seconds.
This example will send a payment of 100 satoshis.

#### Using Macaroons

Expand Down
41 changes: 21 additions & 20 deletions docs/grpc/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,36 +113,37 @@ lnd $ lncli sendpayment --pay_req=<PAY_REQ>
Your Python console should now display the details of the recently satisfied
invoice.

### Bidirectional-streaming RPC
### Server-streaming RPC

```python
from time import sleep
import codecs

def request_generator(dest, amt):
# Initialization code here
counter = 0
print("Starting up")
while True:
request = ln.SendRequest(
dest=dest,
amt=amt,
)
yield request
# Alter parameters here
counter += 1
sleep(2)

# Outputs from lncli are hex-encoded
dest_hex = <RECEIVER_ID_PUBKEY>
# Outputs from lncli are hex-encoded.
dest_hex = "<THE_RECEIVER_NODE_IDENTITY_PUBLIC_KEY_IN_HEX>"
dest_bytes = codecs.decode(dest_hex, 'hex')

request_iterable = request_generator(dest=dest_bytes, amt=100)
amount = 100

payment_hash = "<THE_PAYMENT_HASH_IN_HEX>"
payment_hash_bytes = codecs.decode(payment_hash, 'hex')

final_cltv_delta = <THE_FINAL_CLTV_DELTA_AS_INTEGER>

payment_address = "<THE_PAYMENT_ADDRESS_IN_HEX>"
payment_address_bytes = codecs.decode(payment_address, 'hex')

request = routerrpc.SendPaymentRequest(
dest=dest_bytes,
amt=amount,
payment_hash=payment_hash_bytes,
final_cltv_delta=final_cltv_delta,
payment_addr=payment_address_bytes
)

for payment in stub.SendPayment(request_iterable):
print(payment)
```
This example will send a payment of 100 satoshis every 2 seconds.
This example will send a payment of 100 satoshis.

### Using Macaroons

Expand Down
62 changes: 62 additions & 0 deletions docs/release-notes/release-notes-0.21.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Release Notes
- [Bug Fixes](#bug-fixes)
- [New Features](#new-features)
- [Functional Enhancements](#functional-enhancements)
- [RPC Additions](#rpc-additions)
- [lncli Additions](#lncli-additions)
- [Improvements](#improvements)
- [Functional Updates](#functional-updates)
- [RPC Updates](#rpc-updates)
- [lncli Updates](#lncli-updates)
- [Breaking Changes](#breaking-changes)
- [Performance Improvements](#performance-improvements)
- [Technical and Architectural Updates](#technical-and-architectural-updates)
- [BOLT Spec Updates](#bolt-spec-updates)
- [Testing](#testing)
- [Database](#database)
- [Code Health](#code-health)
- [Tooling and Documentation](#tooling-and-documentation)

# Bug Fixes

# New Features

## Functional Enhancements

## RPC Additions

## lncli Additions

# Improvements
## Functional Updates

## RPC Updates

* [Remove Endpoints](https://github.com/lightningnetwork/lnd/pull/8348):
The following endpoints are removed and replaced with their V2 counterparts:
- `sendpayment` → `sendpaymentv2`
- `sendtoroute` → `sendtoroutev2`
- `sendtoroutesync` → `sendtoroutev2`
- `sendpaymentsync` → `sendpaymentv2`

For more details, please refer to the [Deprecations Section Warning](https://github.com/lightningnetwork/lnd/blob/master/docs/release-notes/release-notes-0.20.0.md#deprecations) in `release-notes-0.20.0`.

## lncli Updates

## Code Health

## Breaking Changes
## Performance Improvements

# Technical and Architectural Updates
## BOLT Spec Updates

## Testing

## Database

## Code Health

## Tooling and Documentation

# Contributors (Alphabetical Order)
35 changes: 14 additions & 21 deletions itest/lnd_channel_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,28 +170,23 @@ func testUpdateChannelPolicy(ht *lntest.HarnessTest) {
routes.Routes[0].Hops[1].AmtToForward = amtSat
routes.Routes[0].Hops[1].AmtToForwardMsat = amtMSat

// Send the payment with the modified value.
alicePayStream := alice.RPC.SendToRoute()

sendReq := &lnrpc.SendToRouteRequest{
// Send the payment with the modified value. The payment is expected to
// fail, and the min_htlc value should be communicated back to us, as
// the attempted HTLC value is too low.
sendReq := &routerrpc.SendToRouteRequest{
PaymentHash: resp.RHash,
Route: routes.Routes[0],
}
err := alicePayStream.Send(sendReq)
require.NoError(ht, err, "unable to send payment")

// We expect this payment to fail, and that the min_htlc value is
// communicated back to us, since the attempted HTLC value was too low.
sendResp, err := ht.ReceiveSendToRouteUpdate(alicePayStream)
require.NoError(ht, err, "unable to receive payment stream")
sendResp := alice.RPC.SendToRouteV2(sendReq)
require.Equal(ht, sendResp.Status, lnrpc.HTLCAttempt_FAILED)

// Expected as part of the error message.
substrs := []string{
"AmountBelowMinimum",
"HtlcMinimumMsat: (lnwire.MilliSatoshi) 5000 mSAT",
"AMOUNT_BELOW_MINIMUM",
"htlc_minimum_msat:5000",
}
for _, s := range substrs {
require.Contains(ht, sendResp.PaymentError, s)
require.Contains(ht, sendResp.Failure.String(), s)
}

// Make sure sending using the original value succeeds.
Expand All @@ -213,17 +208,15 @@ func testUpdateChannelPolicy(ht *lntest.HarnessTest) {
TotalAmtMsat: amtMSat,
}

sendReq = &lnrpc.SendToRouteRequest{
sendReq = &routerrpc.SendToRouteRequest{
PaymentHash: resp.RHash,
Route: route,
}

err = alicePayStream.Send(sendReq)
require.NoError(ht, err, "unable to send payment")

sendResp, err = ht.ReceiveSendToRouteUpdate(alicePayStream)
require.NoError(ht, err, "unable to receive payment stream")
require.Empty(ht, sendResp.PaymentError, "expected payment to succeed")
sendResp = alice.RPC.SendToRouteV2(sendReq)
require.Equal(ht, sendResp.Status, lnrpc.HTLCAttempt_SUCCEEDED)
require.Nilf(ht, sendResp.Failure, "received payment error "+
"from %s", alice.Name())

// With our little cluster set up, we'll update the outbound fees and
// the max htlc size for the Bob side of the Alice->Bob channel, and
Expand Down
Loading
Loading