-
Notifications
You must be signed in to change notification settings - Fork 409
Route blinding groundwork #2128
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
Merged
TheBlueMatt
merged 6 commits into
lightningdevkit:main
from
valentinewallace:2023-03-route-blinding-groundwork
Aug 8, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9c5acf1
Move pending forward htlc construction into method
valentinewallace 9473f1c
Remove indentation in payment receive util
valentinewallace 0c37488
Remove outdated documentation of a panic
valentinewallace 02a6d89
Receive payment onions as new InboundPayload instead of OnionHopData
valentinewallace 67868ae
Replace OnionHopData with OutboundPayload for outbound onions
valentinewallace c9d3544
Remove unnecessary vecs in channel.rs
valentinewallace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3077,9 +3077,9 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> { | |
|
||
let mut htlc_updates = Vec::new(); | ||
mem::swap(&mut htlc_updates, &mut self.context.holding_cell_htlc_updates); | ||
let mut update_add_htlcs = Vec::with_capacity(htlc_updates.len()); | ||
let mut update_fulfill_htlcs = Vec::with_capacity(htlc_updates.len()); | ||
let mut update_fail_htlcs = Vec::with_capacity(htlc_updates.len()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yippee! |
||
let mut update_add_count = 0; | ||
let mut update_fulfill_count = 0; | ||
let mut update_fail_count = 0; | ||
let mut htlcs_to_fail = Vec::new(); | ||
for htlc_update in htlc_updates.drain(..) { | ||
// Note that this *can* fail, though it should be due to rather-rare conditions on | ||
|
@@ -3095,7 +3095,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> { | |
match self.send_htlc(amount_msat, *payment_hash, cltv_expiry, source.clone(), | ||
onion_routing_packet.clone(), false, skimmed_fee_msat, fee_estimator, logger) | ||
{ | ||
Ok(update_add_msg_option) => update_add_htlcs.push(update_add_msg_option.unwrap()), | ||
Ok(_) => update_add_count += 1, | ||
Err(e) => { | ||
match e { | ||
ChannelError::Ignore(ref msg) => { | ||
|
@@ -3122,11 +3122,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> { | |
// not fail - any in between attempts to claim the HTLC will have resulted | ||
// in it hitting the holding cell again and we cannot change the state of a | ||
// holding cell HTLC from fulfill to anything else. | ||
let (update_fulfill_msg_option, mut additional_monitor_update) = | ||
if let UpdateFulfillFetch::NewClaim { msg, monitor_update, .. } = self.get_update_fulfill_htlc(htlc_id, *payment_preimage, logger) { | ||
(msg, monitor_update) | ||
} else { unreachable!() }; | ||
update_fulfill_htlcs.push(update_fulfill_msg_option.unwrap()); | ||
let mut additional_monitor_update = | ||
if let UpdateFulfillFetch::NewClaim { monitor_update, .. } = | ||
self.get_update_fulfill_htlc(htlc_id, *payment_preimage, logger) | ||
{ monitor_update } else { unreachable!() }; | ||
update_fulfill_count += 1; | ||
monitor_update.updates.append(&mut additional_monitor_update.updates); | ||
}, | ||
&HTLCUpdateAwaitingACK::FailHTLC { htlc_id, ref err_packet } => { | ||
|
@@ -3137,7 +3137,8 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> { | |
// not fail - we should never end up in a state where we double-fail | ||
// an HTLC or fail-then-claim an HTLC as it indicates we didn't wait | ||
// for a full revocation before failing. | ||
update_fail_htlcs.push(update_fail_msg_option.unwrap()) | ||
debug_assert!(update_fail_msg_option.is_some()); | ||
update_fail_count += 1; | ||
}, | ||
Err(e) => { | ||
if let ChannelError::Ignore(_) = e {} | ||
|
@@ -3149,7 +3150,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> { | |
}, | ||
} | ||
} | ||
if update_add_htlcs.is_empty() && update_fulfill_htlcs.is_empty() && update_fail_htlcs.is_empty() && self.context.holding_cell_update_fee.is_none() { | ||
if update_add_count == 0 && update_fulfill_count == 0 && update_fail_count == 0 && self.context.holding_cell_update_fee.is_none() { | ||
return (None, htlcs_to_fail); | ||
} | ||
let update_fee = if let Some(feerate) = self.context.holding_cell_update_fee.take() { | ||
|
@@ -3166,7 +3167,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> { | |
|
||
log_debug!(logger, "Freeing holding cell in channel {} resulted in {}{} HTLCs added, {} HTLCs fulfilled, and {} HTLCs failed.", | ||
log_bytes!(self.context.channel_id()), if update_fee.is_some() { "a fee update, " } else { "" }, | ||
update_add_htlcs.len(), update_fulfill_htlcs.len(), update_fail_htlcs.len()); | ||
update_add_count, update_fulfill_count, update_fail_count); | ||
|
||
self.monitor_updating_paused(false, true, false, Vec::new(), Vec::new(), Vec::new()); | ||
(self.push_ret_blockable_mon_update(monitor_update), htlcs_to_fail) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.