Skip to content

Commit 1f900b0

Browse files
committed
f Account for changes in BOLT11 interface
1 parent 6167f59 commit 1f900b0

File tree

7 files changed

+161
-242
lines changed

7 files changed

+161
-242
lines changed

bindings/ldk_node.udl

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dictionary Config {
1212
sequence<PublicKey> trusted_peers_0conf;
1313
u64 probing_liquidity_limit_multiplier;
1414
AnchorChannelsConfig? anchor_channels_config;
15-
SendingParameters? sending_parameters;
15+
RouteParametersConfig? route_parameters;
1616
};
1717

1818
dictionary AnchorChannelsConfig {
@@ -167,13 +167,13 @@ interface Bolt11InvoiceDescription {
167167

168168
interface Bolt11Payment {
169169
[Throws=NodeError]
170-
PaymentId send([ByRef]Bolt11Invoice invoice, SendingParameters? sending_parameters);
170+
PaymentId send([ByRef]Bolt11Invoice invoice, RouteParametersConfig? route_parameters);
171171
[Throws=NodeError]
172-
PaymentId send_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat, SendingParameters? sending_parameters);
172+
PaymentId send_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat, RouteParametersConfig? route_parameters);
173173
[Throws=NodeError]
174-
void send_probes([ByRef]Bolt11Invoice invoice);
174+
void send_probes([ByRef]Bolt11Invoice invoice, RouteParametersConfig? route_parameters);
175175
[Throws=NodeError]
176-
void send_probes_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat);
176+
void send_probes_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat, RouteParametersConfig? route_parameters);
177177
[Throws=NodeError]
178178
void claim_for_hash(PaymentHash payment_hash, u64 claimable_amount_msat, PaymentPreimage preimage);
179179
[Throws=NodeError]
@@ -213,13 +213,13 @@ interface Bolt12Payment {
213213

214214
interface SpontaneousPayment {
215215
[Throws=NodeError]
216-
PaymentId send(u64 amount_msat, PublicKey node_id, SendingParameters? sending_parameters);
216+
PaymentId send(u64 amount_msat, PublicKey node_id, RouteParametersConfig? route_parameters);
217217
[Throws=NodeError]
218-
PaymentId send_with_custom_tlvs(u64 amount_msat, PublicKey node_id, SendingParameters? sending_parameters, sequence<CustomTlvRecord> custom_tlvs);
218+
PaymentId send_with_custom_tlvs(u64 amount_msat, PublicKey node_id, RouteParametersConfig? route_parameters, sequence<CustomTlvRecord> custom_tlvs);
219219
[Throws=NodeError]
220-
PaymentId send_with_preimage(u64 amount_msat, PublicKey node_id, PaymentPreimage preimage, SendingParameters? sending_parameters);
220+
PaymentId send_with_preimage(u64 amount_msat, PublicKey node_id, PaymentPreimage preimage, RouteParametersConfig? route_parameters);
221221
[Throws=NodeError]
222-
PaymentId send_with_preimage_and_custom_tlvs(u64 amount_msat, PublicKey node_id, sequence<CustomTlvRecord> custom_tlvs, PaymentPreimage preimage, SendingParameters? sending_parameters);
222+
PaymentId send_with_preimage_and_custom_tlvs(u64 amount_msat, PublicKey node_id, sequence<CustomTlvRecord> custom_tlvs, PaymentPreimage preimage, RouteParametersConfig? route_parameters);
223223
[Throws=NodeError]
224224
void send_probes(u64 amount_msat, PublicKey node_id);
225225
};
@@ -456,11 +456,11 @@ dictionary PaymentDetails {
456456
u64 latest_update_timestamp;
457457
};
458458

459-
dictionary SendingParameters {
460-
MaxTotalRoutingFeeLimit? max_total_routing_fee_msat;
461-
u32? max_total_cltv_expiry_delta;
462-
u8? max_path_count;
463-
u8? max_channel_saturation_power_of_half;
459+
dictionary RouteParametersConfig {
460+
u64? max_total_routing_fee_msat;
461+
u32 max_total_cltv_expiry_delta;
462+
u8 max_path_count;
463+
u8 max_channel_saturation_power_of_half;
464464
};
465465

466466
dictionary CustomTlvRecord {
@@ -521,12 +521,6 @@ enum LSPS1PaymentState {
521521
"Refunded",
522522
};
523523

524-
[Enum]
525-
interface MaxTotalRoutingFeeLimit {
526-
None ();
527-
Some ( u64 amount_msat );
528-
};
529-
530524
[NonExhaustive]
531525
enum Network {
532526
"Bitcoin",

src/config.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
//! Objects for configuring the node.
99
1010
use crate::logger::LogLevel;
11-
use crate::payment::SendingParameters;
1211

1312
use lightning::ln::msgs::SocketAddress;
1413
use lightning::routing::gossip::NodeAlias;
14+
use lightning::routing::router::RouteParametersConfig;
1515
use lightning::util::config::ChannelConfig as LdkChannelConfig;
1616
use lightning::util::config::MaxDustHTLCExposure as LdkMaxDustHTLCExposure;
1717
use lightning::util::config::UserConfig;
@@ -114,9 +114,9 @@ pub const WALLET_KEYS_SEED_LEN: usize = 64;
114114
/// | `probing_liquidity_limit_multiplier` | 3 |
115115
/// | `log_level` | Debug |
116116
/// | `anchor_channels_config` | Some(..) |
117-
/// | `sending_parameters` | None |
117+
/// | `route_parameters` | None |
118118
///
119-
/// See [`AnchorChannelsConfig`] and [`SendingParameters`] for more information regarding their
119+
/// See [`AnchorChannelsConfig`] and [`RouteParametersConfig`] for more information regarding their
120120
/// respective default values.
121121
///
122122
/// [`Node`]: crate::Node
@@ -173,12 +173,12 @@ pub struct Config {
173173
pub anchor_channels_config: Option<AnchorChannelsConfig>,
174174
/// Configuration options for payment routing and pathfinding.
175175
///
176-
/// Setting the `SendingParameters` provides flexibility to customize how payments are routed,
176+
/// Setting the [`RouteParametersConfig`] provides flexibility to customize how payments are routed,
177177
/// including setting limits on routing fees, CLTV expiry, and channel utilization.
178178
///
179179
/// **Note:** If unset, default parameters will be used, and you will be able to override the
180180
/// parameters on a per-payment basis in the corresponding method calls.
181-
pub sending_parameters: Option<SendingParameters>,
181+
pub route_parameters: Option<RouteParametersConfig>,
182182
}
183183

184184
impl Default for Config {
@@ -191,7 +191,7 @@ impl Default for Config {
191191
trusted_peers_0conf: Vec::new(),
192192
probing_liquidity_limit_multiplier: DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER,
193193
anchor_channels_config: Some(AnchorChannelsConfig::default()),
194-
sending_parameters: None,
194+
route_parameters: None,
195195
node_alias: None,
196196
}
197197
}

src/ffi/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ pub use crate::logger::{LogLevel, LogRecord, LogWriter};
2020
pub use crate::payment::store::{
2121
ConfirmationStatus, LSPFeeLimits, PaymentDirection, PaymentKind, PaymentStatus,
2222
};
23-
pub use crate::payment::{MaxTotalRoutingFeeLimit, QrPaymentResult, SendingParameters};
23+
pub use crate::payment::QrPaymentResult;
2424

2525
pub use lightning::chain::channelmonitor::BalanceSource;
2626
pub use lightning::events::{ClosureReason, PaymentFailureReason};
2727
pub use lightning::ln::types::ChannelId;
2828
pub use lightning::offers::offer::OfferId;
2929
pub use lightning::routing::gossip::{NodeAlias, NodeId, RoutingFees};
30+
pub use lightning::routing::router::RouteParametersConfig;
3031
pub use lightning::util::string::UntrustedString;
3132

3233
pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};

0 commit comments

Comments
 (0)