Skip to content

Commit f2d9eb5

Browse files
committed
f Convert PaymentPreimage to PaymentHasH
1 parent 5776c43 commit f2d9eb5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6511,7 +6511,7 @@ where
65116511
if let hash_map::Entry::Occupied(mut chan_phase_entry) = peer_state.channel_by_id.entry(chan_id) {
65126512
if let ChannelPhase::Funded(chan) = chan_phase_entry.get_mut() {
65136513
let counterparty_node_id = chan.context.get_counterparty_node_id();
6514-
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
6514+
let logger = WithChannelContext::from(&self.logger, &chan.context, Some(PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array())));
65156515
let fulfill_res = chan.get_update_fulfill_htlc_and_commit(prev_hop.htlc_id, payment_preimage, &&logger);
65166516

65176517
match fulfill_res {
@@ -6604,7 +6604,8 @@ where
66046604
// with a preimage we *must* somehow manage to propagate it to the upstream
66056605
// channel, or we must have an ability to receive the same event and try
66066606
// again on restart.
6607-
log_error!(WithContext::from(&self.logger, None, Some(prev_hop.channel_id), None),
6607+
log_error!(WithContext::from(&self.logger, None, Some(prev_hop.channel_id), Some(
6608+
PaymentHash(Sha256::hash(&payment_preimage.0).to_byte_array()))),
66086609
"Critical error: failed to update channel monitor with preimage {:?}: {:?}",
66096610
payment_preimage, update_res);
66106611
}
@@ -7757,7 +7758,7 @@ where
77577758
if let ChannelPhase::Funded(chan) = chan_phase_entry.get_mut() {
77587759
let res = try_chan_phase_entry!(self, chan.update_fulfill_htlc(&msg), chan_phase_entry);
77597760
if let HTLCSource::PreviousHopData(prev_hop) = &res.0 {
7760-
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
7761+
let logger = WithChannelContext::from(&self.logger, &chan.context, Some(PaymentHash(Sha256::hash(&msg.payment_preimage.0).to_byte_array())));
77617762
log_trace!(logger,
77627763
"Holding the next revoke_and_ack from {} until the preimage is durably persisted in the inbound edge's ChannelMonitor",
77637764
msg.channel_id);

0 commit comments

Comments
 (0)