Skip to content

Commit

Permalink
AllPayments flag in newest LND daily gRPC, a flag is now required for…
Browse files Browse the repository at this point in the history
… DeletePayments call. version bump 1.64
  • Loading branch information
rsafier committed Apr 29, 2024
1 parent 4f07cb3 commit 41fd16b
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 43 deletions.
52 changes: 50 additions & 2 deletions LNUnit.LND/Grpc/lightning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,18 @@ message LightningAddress {
string host = 2;
}

enum CoinSelectionStrategy {
// Use the coin selection strategy defined in the global configuration
// (lnd.conf).
STRATEGY_USE_GLOBAL_CONFIG = 0;

// Select the largest available coins first during coin selection.
STRATEGY_LARGEST = 1;

// Randomly select the available coins during coin selection.
STRATEGY_RANDOM = 2;
}

message EstimateFeeRequest {
// The map from addresses to amounts for the transaction.
map<string, int64> AddrToAmount = 1;
Expand All @@ -1105,6 +1117,9 @@ message EstimateFeeRequest {

// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 4;

// The strategy to use for selecting coins during fees estimation.
CoinSelectionStrategy coin_selection_strategy = 5;
}

message EstimateFeeResponse {
Expand Down Expand Up @@ -1145,6 +1160,9 @@ message SendManyRequest {

// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 8;

// The strategy to use for selecting coins during sending many requests.
CoinSelectionStrategy coin_selection_strategy = 9;
}
message SendManyResponse {
// The id of the transaction
Expand Down Expand Up @@ -1187,6 +1205,9 @@ message SendCoinsRequest {

// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 9;

// The strategy to use for selecting coins.
CoinSelectionStrategy coin_selection_strategy = 10;
}
message SendCoinsResponse {
// The transaction ID of the transaction
Expand Down Expand Up @@ -2115,6 +2136,9 @@ message BatchOpenChannelRequest {

// An optional label for the batch transaction, limited to 500 characters.
string label = 6;

// The strategy to use for selecting coins during batch opening channels.
CoinSelectionStrategy coin_selection_strategy = 7;
}

message BatchOpenChannel {
Expand Down Expand Up @@ -3330,6 +3354,9 @@ message RoutingPolicy {

// Custom channel update tlv records.
map<uint64, bytes> custom_records = 8;

int32 inbound_fee_base_msat = 9;
int32 inbound_fee_rate_milli_msat = 10;
}

/*
Expand Down Expand Up @@ -3545,8 +3572,11 @@ message BlindedPaymentPath {
// The base fee for the blinded path provided, expressed in msat.
uint64 base_fee_msat = 2;

// The proportional fee for the blinded path provided, expressed in msat.
uint64 proportional_fee_msat = 3;
/*
The proportional fee for the blinded path provided, expressed in parts
per million.
*/
uint32 proportional_fee_rate = 3;

/*
The total CLTV delta for the blinded path provided, including the
Expand Down Expand Up @@ -4201,6 +4231,10 @@ message DeleteAllPaymentsRequest {
Only delete failed HTLCs from payments, not the payment itself.
*/
bool failed_htlcs_only = 2;

// Delete all payments. NOTE: Using this option requires careful
// consideration as it is a destructive operation.
bool all_payments = 3;
}

message DeletePaymentResponse {
Expand Down Expand Up @@ -4277,6 +4311,8 @@ enum FeatureBit {
ANCHORS_OPT = 21;
ANCHORS_ZERO_FEE_HTLC_REQ = 22;
ANCHORS_ZERO_FEE_HTLC_OPT = 23;
ROUTE_BLINDING_REQUIRED = 24;
ROUTE_BLINDING_OPTIONAL = 25;
AMP_REQ = 30;
AMP_OPT = 31;
}
Expand Down Expand Up @@ -4306,7 +4342,15 @@ message ChannelFeeReport {
// The effective fee rate in milli-satoshis. Computed by dividing the
// fee_per_mil value by 1 million.
double fee_rate = 4;

// The base fee charged regardless of the number of milli-satoshis sent.
int32 inbound_base_fee_msat = 6;

// The amount charged per milli-satoshis transferred expressed in
// millionths of a satoshi.
int32 inbound_fee_per_mil = 7;
}

message FeeReportResponse {
// An array of channel fee reports which describes the current fee schedule
// for each channel.
Expand Down Expand Up @@ -4357,7 +4401,11 @@ message PolicyUpdateRequest {

// If true, min_htlc_msat is applied.
bool min_htlc_msat_specified = 8;

int32 inbound_base_fee_msat = 10;
int32 inbound_fee_rate_ppm = 11;
}

enum UpdateFailure {
UPDATE_FAILURE_UNKNOWN = 0;
UPDATE_FAILURE_PENDING = 1;
Expand Down
125 changes: 89 additions & 36 deletions LNUnit.LND/Grpc/walletrpc/walletkit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -242,31 +242,34 @@ service WalletKit {
rpc PendingSweeps (PendingSweepsRequest) returns (PendingSweepsResponse);

/* lncli: `wallet bumpfee`
BumpFee bumps the fee of an arbitrary input within a transaction. This RPC
takes a different approach than bitcoind's bumpfee command. lnd has a
central batching engine in which inputs with similar fee rates are batched
together to save on transaction fees. Due to this, we cannot rely on
bumping the fee on a specific transaction, since transactions can change at
any point with the addition of new inputs. The list of inputs that
currently exist within lnd's central batching engine can be retrieved
through the PendingSweeps RPC.
When bumping the fee of an input that currently exists within lnd's central
batching engine, a higher fee transaction will be created that replaces the
lower fee transaction through the Replace-By-Fee (RBF) policy. If it
BumpFee is an endpoint that allows users to interact with lnd's sweeper
directly. It takes an outpoint from an unconfirmed transaction and sends it
to the sweeper for potential fee bumping. Depending on whether the outpoint
has been registered in the sweeper (an existing input, e.g., an anchor
output) or not (a new input, e.g., an unconfirmed wallet utxo), this will
either be an RBF or CPFP attempt.
When receiving an input, lnd’s sweeper needs to understand its time
sensitivity to make economical fee bumps - internally a fee function is
created using the deadline and budget to guide the process. When the
deadline is approaching, the fee function will increase the fee rate and
perform an RBF.
When a force close happens, all the outputs from the force closing
transaction will be registered in the sweeper. The sweeper will then handle
the creation, publish, and fee bumping of the sweeping transactions.
Everytime a new block comes in, unless the sweeping transaction is
confirmed, an RBF is attempted. To interfere with this automatic process,
users can use BumpFee to specify customized fee rate, budget, deadline, and
whether the sweep should happen immediately. It's recommended to call
`ListSweeps` to understand the shape of the existing sweeping transaction
first - depending on the number of inputs in this transaction, the RBF
requirements can be quite different.
This RPC also serves useful when wanting to perform a Child-Pays-For-Parent
(CPFP), where the child transaction pays for its parent's fee. This can be
done by specifying an outpoint within the low fee transaction that is under
the control of the wallet.
The fee preference can be expressed either as a specific fee rate or a delta
of blocks in which the output should be swept on-chain within. If a fee
preference is not explicitly specified, then an error is returned.
Note that this RPC currently doesn't perform any validation checks on the
fee preference being provided. For now, the responsibility of ensuring that
the new fee preference is sufficient is delegated to the user.
*/
rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse);

Expand Down Expand Up @@ -813,6 +816,9 @@ message SendOutputsRequest {

// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 5;

// The strategy to use for selecting coins during sending the outputs.
lnrpc.CoinSelectionStrategy coin_selection_strategy = 6;
}
message SendOutputsResponse {
/*
Expand Down Expand Up @@ -1102,33 +1108,56 @@ message PendingSweep {
uint32 broadcast_attempts = 5;

/*
Deprecated.
The next height of the chain at which we'll attempt to broadcast the
sweep transaction of the output.
*/
uint32 next_broadcast_height = 6;
uint32 next_broadcast_height = 6 [deprecated = true];

// The requested confirmation target for this output.
uint32 requested_conf_target = 8;
/*
Deprecated, use immediate.
Whether this input must be force-swept. This means that it is swept
immediately.
*/
bool force = 7 [deprecated = true];

/*
Deprecated, use deadline.
The requested confirmation target for this output, which is the deadline
used by the sweeper.
*/
uint32 requested_conf_target = 8 [deprecated = true];

// Deprecated, use requested_sat_per_vbyte.
// The requested fee rate, expressed in sat/vbyte, for this output.
uint32 requested_sat_per_byte = 9 [deprecated = true];

/*
The fee rate we'll use to sweep the output, expressed in sat/vbyte. The fee
rate is only determined once a sweeping transaction for the output is
created, so it's possible for this to be 0 before this.
The current fee rate we'll use to sweep the output, expressed in sat/vbyte.
The fee rate is only determined once a sweeping transaction for the output
is created, so it's possible for this to be 0 before this.
*/
uint64 sat_per_vbyte = 10;

// The requested fee rate, expressed in sat/vbyte, for this output.
// The requested starting fee rate, expressed in sat/vbyte, for this
// output. When not requested, this field will be 0.
uint64 requested_sat_per_vbyte = 11;

/*
Whether this input must be force-swept. This means that it is swept even
if it has a negative yield.
Whether this input will be swept immediately.
*/
bool force = 7;
bool immediate = 12;

/*
The budget for this sweep, expressed in satoshis. This is the maximum amount
that can be spent as fees to sweep this output.
*/
uint64 budget = 13;

/*
The deadline height used for this output when perform fee bumping.
*/
uint32 deadline_height = 14;
}

message PendingSweepsRequest {
Expand All @@ -1145,7 +1174,9 @@ message BumpFeeRequest {
// The input we're attempting to bump the fee of.
lnrpc.OutPoint outpoint = 1;

// The target number of blocks that the input should be spent within.
// Optional. The deadline in number of blocks that the input should be spent
// within. When not set, for new inputs, the default value (1008) is used;
// for exiting inputs, their current values will be retained.
uint32 target_conf = 2;

/*
Expand All @@ -1156,16 +1187,35 @@ message BumpFeeRequest {
uint32 sat_per_byte = 3 [deprecated = true];

/*
Whether this input must be force-swept. This means that it is swept even
if it has a negative yield.
Deprecated, use immediate.
Whether this input must be force-swept. This means that it is swept
immediately.
*/
bool force = 4;
bool force = 4 [deprecated = true];

/*
The fee rate, expressed in sat/vbyte, that should be used to spend the input
with.
Optional. The starting fee rate, expressed in sat/vbyte, that will be used
to spend the input with initially. This value will be used by the sweeper's
fee function as its starting fee rate. When not set, the sweeper will use
the estimated fee rate using the `target_conf` as the starting fee rate.
*/
uint64 sat_per_vbyte = 5;

/*
Optional. Whether this input will be swept immediately. When set to true,
the sweeper will sweep this input without waiting for the next batch.
*/
bool immediate = 6;

/*
Optional. The max amount in sats that can be used as the fees. Setting this
value greater than the input's value may result in CPFP - one or more wallet
utxos will be used to pay the fees specified by the budget. If not set, for
new inputs, by default 50% of the input's value will be treated as the
budget for fee bumping; for existing inputs, their current budgets will be
retained.
*/
uint64 budget = 7;
}

message BumpFeeResponse {
Expand Down Expand Up @@ -1308,6 +1358,9 @@ message FundPsbtRequest {
// accounts, no change type should be provided as the coin selection key
// scope will always be used to generate the change address.
ChangeAddressType change_type = 8;

// The strategy to use for selecting coins during funding the PSBT.
lnrpc.CoinSelectionStrategy coin_selection_strategy = 10;
}
message FundPsbtResponse {
/*
Expand Down
2 changes: 1 addition & 1 deletion LNUnit.LND/LNUnit.LND.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>LNUnit.LND</PackageId>
<Version>1.6.3</Version>
<Version>1.6.4</Version>
<PackageDescription>LNUnit LND Typed Clients</PackageDescription>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion LNUnit.Tests/AbcLightningFixtureBoltDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace LNUnit.Tests;

[TestFixture("boltdb", "lightninglabs/lnd", "daily-testing-only", "/root/.lnd", true)]
[TestFixture("boltdb", "custom_lnd", "latest", "/home/lnd/.lnd", false)]
//[TestFixture("boltdb", "custom_lnd", "latest", "/home/lnd/.lnd", false)]
public class AbcLightningAbstractTestsBoltDb : LNUnit.Tests.Abstract.AbcLightningAbstractTests
{
public AbcLightningAbstractTestsBoltDb(string dbType = "boltdb",
Expand Down
7 changes: 5 additions & 2 deletions LNUnit.Tests/Abstract/AbcLightningAbstractTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,13 +1065,16 @@ public async Task ListInvoiceAndPaymentNoDatePage()
var bob = await Builder.WaitUntilAliasIsServerReady("bob");

//purge data
await bob.LightningClient.DeleteAllPaymentsAsync(new DeleteAllPaymentsRequest());
await bob.LightningClient.DeleteAllPaymentsAsync(new DeleteAllPaymentsRequest()
{
AllPayments = true,
});

var payment = await Builder.MakeLightningPaymentFromAlias("bob", new SendPaymentRequest
{
PaymentRequest = invoice.PaymentRequest,
FeeLimitSat = 100000000,
TimeoutSeconds = 5
TimeoutSeconds = 5,
});
Assert.That(payment.Status == Payment.Types.PaymentStatus.Succeeded);

Expand Down
2 changes: 1 addition & 1 deletion LNUnit/LNUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<Version>1.6.3</Version>
<Version>1.6.4</Version>
<IsPackable>true</IsPackable>
<PackageId>LNUnit</PackageId>
<PackageDescription>Lightning Network Unit Testing Framework</PackageDescription>
Expand Down

0 comments on commit 41fd16b

Please sign in to comment.