Skip to content

Commit 63c7f9b

Browse files
authored
Merge pull request lightningdevkit#825 from carlaKC/trampoline-deps
Bump rust-lightning to include trampoline changes
2 parents 9e0a812 + 130a27b commit 63c7f9b

File tree

2 files changed

+59
-48
lines changed

2 files changed

+59
-48
lines changed

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ default = []
3939
#lightning-liquidity = { version = "0.2.0", features = ["std"] }
4040
#lightning-macros = { version = "0.2.0" }
4141

42-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["std"] }
43-
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204" }
44-
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["std"] }
45-
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204" }
46-
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["tokio"] }
47-
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204" }
48-
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204" }
49-
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["rest-client", "rpc-client", "tokio"] }
50-
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
51-
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["std"] }
52-
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204" }
42+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["std"] }
43+
lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a" }
44+
lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["std"] }
45+
lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a" }
46+
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["tokio"] }
47+
lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a" }
48+
lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a" }
49+
lightning-block-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["rest-client", "rpc-client", "tokio"] }
50+
lightning-transaction-sync = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
51+
lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["std"] }
52+
lightning-macros = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a" }
5353

5454
bdk_chain = { version = "0.23.0", default-features = false, features = ["std"] }
5555
bdk_esplora = { version = "0.22.0", default-features = false, features = ["async-https-rustls", "tokio"]}
@@ -79,13 +79,13 @@ async-trait = { version = "0.1", default-features = false }
7979
vss-client = { package = "vss-client-ng", version = "0.5" }
8080
prost = { version = "0.11.6", default-features = false}
8181
#bitcoin-payment-instructions = { version = "0.6" }
82-
bitcoin-payment-instructions = { git = "https://github.com/jkczyz/bitcoin-payment-instructions", rev = "0138feb7acefb1e49102a6fb46d7b776bf43265e" }
82+
bitcoin-payment-instructions = { git = "https://github.com/carlaKC/bitcoin-payment-instructions", rev = "c22c9b836b70d4c915dd28701e11083a8b558d56" }
8383

8484
[target.'cfg(windows)'.dependencies]
8585
winapi = { version = "0.3", features = ["winbase"] }
8686

8787
[dev-dependencies]
88-
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["std", "_test_utils"] }
88+
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["std", "_test_utils"] }
8989
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
9090
proptest = "1.0.0"
9191
regex = "1.5.6"

src/event.rs

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,12 +1306,8 @@ where
13061306
}
13071307
},
13081308
LdkEvent::PaymentForwarded {
1309-
prev_channel_id,
1310-
next_channel_id,
1311-
prev_user_channel_id,
1312-
next_user_channel_id,
1313-
prev_node_id,
1314-
next_node_id,
1309+
prev_htlcs,
1310+
next_htlcs,
13151311
total_fee_earned_msat,
13161312
skimmed_fee_msat,
13171313
claim_from_onchain_tx,
@@ -1322,11 +1318,10 @@ where
13221318
let nodes = read_only_network_graph.nodes();
13231319
let channels = self.channel_manager.list_channels();
13241320

1325-
let node_str = |channel_id: &Option<ChannelId>| {
1326-
channel_id
1327-
.and_then(|channel_id| {
1328-
channels.iter().find(|c| c.channel_id == channel_id)
1329-
})
1321+
let node_str = |channel_id: &ChannelId| {
1322+
channels
1323+
.iter()
1324+
.find(|c| c.channel_id == *channel_id)
13301325
.and_then(|channel| {
13311326
nodes.get(&NodeId::from_pubkey(&channel.counterparty.node_id))
13321327
})
@@ -1338,58 +1333,74 @@ where
13381333
})
13391334
})
13401335
};
1341-
let channel_str = |channel_id: &Option<ChannelId>| {
1342-
channel_id
1343-
.map(|channel_id| format!(" with channel {}", channel_id))
1344-
.unwrap_or_default()
1345-
};
1346-
let from_prev_str = format!(
1347-
" from {}{}",
1348-
node_str(&prev_channel_id),
1349-
channel_str(&prev_channel_id)
1350-
);
1351-
let to_next_str = format!(
1352-
" to {}{}",
1353-
node_str(&next_channel_id),
1354-
channel_str(&next_channel_id)
1355-
);
1336+
let from_prev_str: String = prev_htlcs
1337+
.iter()
1338+
.map(|htlc| {
1339+
format!("with {} on {}", node_str(&htlc.channel_id), htlc.channel_id)
1340+
})
1341+
.collect::<Vec<_>>()
1342+
.join(", ");
1343+
1344+
let to_next_str: String = next_htlcs
1345+
.iter()
1346+
.map(|htlc| {
1347+
format!("with {} on {}", node_str(&htlc.channel_id), htlc.channel_id)
1348+
})
1349+
.collect::<Vec<_>>()
1350+
.join(", ");
13561351

13571352
let fee_earned = total_fee_earned_msat.unwrap_or(0);
13581353
if claim_from_onchain_tx {
13591354
log_info!(
13601355
self.logger,
1361-
"Forwarded payment{}{} of {}msat, earning {}msat in fees from claiming onchain.",
1356+
"Forwarded payment with {} inbound HTLC(s) ({}) and {} outbound HTLC(s) ({}) of {}msat, earning {}msat in fees from claiming onchain.",
1357+
prev_htlcs.len(),
13621358
from_prev_str,
1359+
next_htlcs.len(),
13631360
to_next_str,
13641361
outbound_amount_forwarded_msat.unwrap_or(0),
13651362
fee_earned,
13661363
);
13671364
} else {
13681365
log_info!(
13691366
self.logger,
1370-
"Forwarded payment{}{} of {}msat, earning {}msat in fees.",
1367+
"Forwarded payment with {} inbound HTLC(s) ({}) and {} outbound HTLC(s) ({}) of {}msat, earning {}msat in fees.",
1368+
prev_htlcs.len(),
13711369
from_prev_str,
1370+
next_htlcs.len(),
13721371
to_next_str,
13731372
outbound_amount_forwarded_msat.unwrap_or(0),
13741373
fee_earned,
13751374
);
13761375
}
13771376
}
13781377

1378+
// We only allow multiple HTLCs in/out for trampoline forwards, which have not yet
1379+
// been fully implemented in LDK, so we do not lose any information by just
1380+
// reporting the first HTLC in each vec.
1381+
debug_assert_eq!(prev_htlcs.len(), 1, "unexpected number of prev_htlcs");
1382+
debug_assert_eq!(next_htlcs.len(), 1, "unexpected number of next_htlcs");
1383+
let prev_htlc = prev_htlcs
1384+
.first()
1385+
.expect("we expect at least one prev_htlc for PaymentForwarded");
1386+
let next_htlc = next_htlcs
1387+
.first()
1388+
.expect("we expect at least one next_htlc for PaymentForwarded");
1389+
13791390
if let Some(liquidity_source) = self.liquidity_source.as_ref() {
13801391
let skimmed_fee_msat = skimmed_fee_msat.unwrap_or(0);
13811392
liquidity_source
1382-
.handle_payment_forwarded(next_channel_id, skimmed_fee_msat)
1393+
.handle_payment_forwarded(Some(next_htlc.channel_id), skimmed_fee_msat)
13831394
.await;
13841395
}
13851396

13861397
let event = Event::PaymentForwarded {
1387-
prev_channel_id: prev_channel_id.expect("prev_channel_id expected for events generated by LDK versions greater than 0.0.107."),
1388-
next_channel_id: next_channel_id.expect("next_channel_id expected for events generated by LDK versions greater than 0.0.107."),
1389-
prev_user_channel_id: prev_user_channel_id.map(UserChannelId),
1390-
next_user_channel_id: next_user_channel_id.map(UserChannelId),
1391-
prev_node_id,
1392-
next_node_id,
1398+
prev_channel_id: prev_htlc.channel_id,
1399+
next_channel_id: next_htlc.channel_id,
1400+
prev_user_channel_id: prev_htlc.user_channel_id.map(UserChannelId),
1401+
next_user_channel_id: next_htlc.user_channel_id.map(UserChannelId),
1402+
prev_node_id: prev_htlc.node_id,
1403+
next_node_id: next_htlc.node_id,
13931404
total_fee_earned_msat,
13941405
skimmed_fee_msat,
13951406
claim_from_onchain_tx,

0 commit comments

Comments
 (0)