Skip to content

Commit 50e6086

Browse files
jkczyztankyleo
authored andcommitted
Bump the ldk-node dependency
1 parent cd0b6ea commit 50e6086

File tree

10 files changed

+987
-667
lines changed

10 files changed

+987
-667
lines changed

Cargo.lock

Lines changed: 936 additions & 650 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ldk-server-protos/src/proto/types.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ message Bolt11Jit {
101101
// See [`LdkChannelConfig::accept_underpaying_htlcs`](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelConfig.html#structfield.accept_underpaying_htlcs)
102102
// for more information.
103103
LSPFeeLimits lsp_fee_limits = 4;
104+
105+
// The value, in thousands of a satoshi, that was deducted from this payment as an extra
106+
// fee taken by our channel counterparty.
107+
//
108+
// Will only be `Some` once we received the payment.
109+
optional uint64 counterparty_skimmed_fee_msat = 5;
104110
}
105111

106112
// Represents a BOLT 12 ‘offer’ payment, i.e., a payment for an Offer.

ldk-server-protos/src/types.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ pub struct Bolt11Jit {
134134
/// for more information.
135135
#[prost(message, optional, tag = "4")]
136136
pub lsp_fee_limits: ::core::option::Option<LspFeeLimits>,
137+
/// The value, in thousands of a satoshi, that was deducted from this payment as an extra
138+
/// fee taken by our channel counterparty.
139+
///
140+
/// Will only be `Some` once we received the payment.
141+
#[prost(uint64, optional, tag = "5")]
142+
pub counterparty_skimmed_fee_msat: ::core::option::Option<u64>,
137143
}
138144
/// Represents a BOLT 12 ‘offer’ payment, i.e., a payment for an Offer.
139145
#[allow(clippy::derive_partial_eq_without_eq)]

ldk-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
ldk-node = { git = "https://github.com/lightningdevkit/ldk-node.git", rev = "f0338d19256615088fabab2b6927d478ae3ec1a1" }
7+
ldk-node = { git = "https://github.com/lightningdevkit/ldk-node.git", tag = "v0.7.0-rc.0" }
88
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
99
hyper = { version = "1", default-features = false, features = ["server", "http1"] }
1010
http-body-util = { version = "0.1", default-features = false }

ldk-server/ldk-server-config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ max_payment_size_msat = 25000000000 # 0.25 BTC
5757
## A token we may require to be sent by the clients.
5858
## If set, only requests matching this token will be accepted. (uncomment and set if required)
5959
# require_token = ""
60+
61+
client_trusts_lsp = false

ldk-server/src/api/bolt12_send.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ pub(crate) fn handle_bolt12_send_request(
1313
Offer::from_str(&request.offer.as_str()).map_err(|_| ldk_node::NodeError::InvalidOffer)?;
1414

1515
let payment_id = match request.amount_msat {
16-
None => context.node.bolt12_payment().send(&offer, request.quantity, request.payer_note),
16+
None => {
17+
context.node.bolt12_payment().send(&offer, request.quantity, request.payer_note, None)
18+
},
1719
Some(amount_msat) => context.node.bolt12_payment().send_using_amount(
1820
&offer,
1921
amount_msat,
2022
request.quantity,
2123
request.payer_note,
24+
None,
2225
),
2326
}?;
2427

ldk-server/src/api/error.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ impl From<NodeError> for LdkServerError {
7878
| NodeError::InvalidNodeAlias
7979
| NodeError::InvalidDateTime
8080
| NodeError::InvalidFeeRate
81-
| NodeError::UriParameterParsingFailed => {
81+
| NodeError::UriParameterParsingFailed
82+
| NodeError::InvalidBlindedPaths
83+
| NodeError::AsyncPaymentServicesDisabled => {
8284
(error.to_string(), LdkServerErrorCode::InvalidRequestError)
8385
},
8486

@@ -96,6 +98,7 @@ impl From<NodeError> for LdkServerError {
9698
| NodeError::DuplicatePayment
9799
| NodeError::InsufficientFunds
98100
| NodeError::UnsupportedCurrency
101+
| NodeError::ChannelSplicingFailed
99102
| NodeError::LiquidityFeeTooHigh => (error.to_string(), LdkServerErrorCode::LightningError),
100103

101104
NodeError::AlreadyRunning

ldk-server/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ fn main() {
107107
},
108108
};
109109

110+
builder.set_runtime(runtime.handle().clone());
111+
110112
let node = match builder.build() {
111113
Ok(node) => Arc::new(node),
112114
Err(e) => {
@@ -136,7 +138,7 @@ fn main() {
136138
};
137139

138140
println!("Starting up...");
139-
match node.start_with_runtime(Arc::clone(&runtime)) {
141+
match node.start() {
140142
Ok(()) => {},
141143
Err(e) => {
142144
eprintln!("Failed to start up LDK Node: {}", e);

ldk-server/src/util/config.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct LSPS2ServiceTomlConfig {
189189
min_payment_size_msat: u64,
190190
max_payment_size_msat: u64,
191191
require_token: Option<String>,
192+
client_trusts_lsp: bool,
192193
}
193194

194195
impl Into<LSPS2ServiceConfig> for LSPS2ServiceTomlConfig {
@@ -204,6 +205,7 @@ impl Into<LSPS2ServiceConfig> for LSPS2ServiceTomlConfig {
204205
min_payment_size_msat,
205206
max_payment_size_msat,
206207
require_token,
208+
client_trusts_lsp,
207209
} => LSPS2ServiceConfig {
208210
advertise_service,
209211
channel_opening_fee_ppm,
@@ -214,6 +216,7 @@ impl Into<LSPS2ServiceConfig> for LSPS2ServiceTomlConfig {
214216
max_client_to_self_delay,
215217
max_payment_size_msat,
216218
require_token,
219+
client_trusts_lsp,
217220
},
218221
}
219222
}
@@ -274,6 +277,7 @@ mod tests {
274277
max_client_to_self_delay = 1440 # ~10 days
275278
min_payment_size_msat = 10000000 # 10,000 satoshis
276279
max_payment_size_msat = 25000000000 # 0.25 BTC
280+
client_trusts_lsp = false
277281
"#;
278282

279283
fs::write(storage_path.join(config_file_name), toml_config).unwrap();
@@ -304,6 +308,7 @@ mod tests {
304308
max_client_to_self_delay: 1440,
305309
min_payment_size_msat: 10000000,
306310
max_payment_size_msat: 25000000000,
311+
client_trusts_lsp: false,
307312
}),
308313
};
309314

@@ -353,6 +358,7 @@ mod tests {
353358
max_client_to_self_delay = 1440 # ~10 days
354359
min_payment_size_msat = 10000000 # 10,000 satoshis
355360
max_payment_size_msat = 25000000000 # 0.25 BTC
361+
client_trusts_lsp = false
356362
"#;
357363

358364
fs::write(storage_path.join(config_file_name), toml_config).unwrap();
@@ -399,6 +405,7 @@ mod tests {
399405
max_client_to_self_delay = 1440 # ~10 days
400406
min_payment_size_msat = 10000000 # 10,000 satoshis
401407
max_payment_size_msat = 25000000000 # 0.25 BTC
408+
client_trusts_lsp = false
402409
"#;
403410

404411
fs::write(storage_path.join(config_file_name), toml_config).unwrap();

ldk-server/src/util/proto_adapter.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,24 @@ pub(crate) fn payment_kind_to_proto(
147147
secret: secret.map(|s| Bytes::copy_from_slice(&s.0)),
148148
})),
149149
},
150-
PaymentKind::Bolt11Jit { hash, preimage, secret, lsp_fee_limits } => {
151-
ldk_server_protos::types::PaymentKind {
152-
kind: Some(Bolt11Jit(ldk_server_protos::types::Bolt11Jit {
153-
hash: hash.to_string(),
154-
preimage: preimage.map(|p| p.to_string()),
155-
secret: secret.map(|s| Bytes::copy_from_slice(&s.0)),
156-
lsp_fee_limits: Some(LspFeeLimits {
157-
max_total_opening_fee_msat: lsp_fee_limits.max_total_opening_fee_msat,
158-
max_proportional_opening_fee_ppm_msat: lsp_fee_limits
159-
.max_proportional_opening_fee_ppm_msat,
160-
}),
161-
})),
162-
}
150+
PaymentKind::Bolt11Jit {
151+
hash,
152+
preimage,
153+
secret,
154+
lsp_fee_limits,
155+
counterparty_skimmed_fee_msat,
156+
} => ldk_server_protos::types::PaymentKind {
157+
kind: Some(Bolt11Jit(ldk_server_protos::types::Bolt11Jit {
158+
hash: hash.to_string(),
159+
preimage: preimage.map(|p| p.to_string()),
160+
secret: secret.map(|s| Bytes::copy_from_slice(&s.0)),
161+
lsp_fee_limits: Some(LspFeeLimits {
162+
max_total_opening_fee_msat: lsp_fee_limits.max_total_opening_fee_msat,
163+
max_proportional_opening_fee_ppm_msat: lsp_fee_limits
164+
.max_proportional_opening_fee_ppm_msat,
165+
}),
166+
counterparty_skimmed_fee_msat,
167+
})),
163168
},
164169
PaymentKind::Bolt12Offer { hash, preimage, secret, offer_id, payer_note, quantity } => {
165170
ldk_server_protos::types::PaymentKind {

0 commit comments

Comments
 (0)