Skip to content

Commit 2950ffe

Browse files
authored
Merge pull request #303 from TheBlueMatt/2019-01-log-more
Add a bunch of additional logging
2 parents 8845d53 + 5f4bb59 commit 2950ffe

File tree

4 files changed

+121
-75
lines changed

4 files changed

+121
-75
lines changed

src/ln/channel.rs

Lines changed: 104 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use chain::transaction::OutPoint;
2525
use chain::keysinterface::{ChannelKeys, KeysInterface};
2626
use util::transaction_utils;
2727
use util::ser::{Readable, ReadableArgs, Writeable, Writer, WriterWriteAdaptor};
28-
use util::logger::Logger;
28+
use util::logger::{Logger, LogHolder};
2929
use util::errors::APIError;
3030
use util::config::{UserConfig,ChannelConfig};
3131

@@ -783,6 +783,8 @@ impl Channel {
783783
let mut local_htlc_total_msat = 0;
784784
let mut value_to_self_msat_offset = 0;
785785

786+
log_trace!(self, "Building commitment transaction number {} for {}, generated by {} with fee {}...", commitment_number, if local { "us" } else { "remote" }, if generated_by_local { "us" } else { "remote" }, feerate_per_kw);
787+
786788
macro_rules! get_htlc_in_commitment {
787789
($htlc: expr, $offered: expr) => {
788790
HTLCOutputInCommitment {
@@ -796,44 +798,49 @@ impl Channel {
796798
}
797799

798800
macro_rules! add_htlc_output {
799-
($htlc: expr, $outbound: expr, $source: expr) => {
801+
($htlc: expr, $outbound: expr, $source: expr, $state_name: expr) => {
800802
if $outbound == local { // "offered HTLC output"
801803
let htlc_in_tx = get_htlc_in_commitment!($htlc, true);
802804
if $htlc.amount_msat / 1000 >= dust_limit_satoshis + (feerate_per_kw * HTLC_TIMEOUT_TX_WEIGHT / 1000) {
805+
log_trace!(self, " ...including {} {} HTLC {} (hash {}) with value {}", if $outbound { "outbound" } else { "inbound" }, $state_name, $htlc.htlc_id, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
803806
txouts.push((TxOut {
804807
script_pubkey: chan_utils::get_htlc_redeemscript(&htlc_in_tx, &keys).to_v0_p2wsh(),
805808
value: $htlc.amount_msat / 1000
806809
}, Some((htlc_in_tx, $source))));
807810
} else {
811+
log_trace!(self, " ...including {} {} dust HTLC {} (hash {}) with value {} due to dust limit", if $outbound { "outbound" } else { "inbound" }, $state_name, $htlc.htlc_id, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
808812
included_dust_htlcs.push((htlc_in_tx, $source));
809813
}
810814
} else {
811815
let htlc_in_tx = get_htlc_in_commitment!($htlc, false);
812816
if $htlc.amount_msat / 1000 >= dust_limit_satoshis + (feerate_per_kw * HTLC_SUCCESS_TX_WEIGHT / 1000) {
817+
log_trace!(self, " ...including {} {} HTLC {} (hash {}) with value {}", if $outbound { "outbound" } else { "inbound" }, $state_name, $htlc.htlc_id, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
813818
txouts.push((TxOut { // "received HTLC output"
814819
script_pubkey: chan_utils::get_htlc_redeemscript(&htlc_in_tx, &keys).to_v0_p2wsh(),
815820
value: $htlc.amount_msat / 1000
816821
}, Some((htlc_in_tx, $source))));
817822
} else {
823+
log_trace!(self, " ...including {} {} dust HTLC {} (hash {}) with value {}", if $outbound { "outbound" } else { "inbound" }, $state_name, $htlc.htlc_id, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
818824
included_dust_htlcs.push((htlc_in_tx, $source));
819825
}
820826
}
821827
}
822828
}
823829

824830
for ref htlc in self.pending_inbound_htlcs.iter() {
825-
let include = match htlc.state {
826-
InboundHTLCState::RemoteAnnounced(_) => !generated_by_local,
827-
InboundHTLCState::AwaitingRemoteRevokeToAnnounce(_) => !generated_by_local,
828-
InboundHTLCState::AwaitingAnnouncedRemoteRevoke(_) => true,
829-
InboundHTLCState::Committed => true,
830-
InboundHTLCState::LocalRemoved(_) => !generated_by_local,
831+
let (include, state_name) = match htlc.state {
832+
InboundHTLCState::RemoteAnnounced(_) => (!generated_by_local, "RemoteAnnounced"),
833+
InboundHTLCState::AwaitingRemoteRevokeToAnnounce(_) => (!generated_by_local, "AwaitingRemoteRevokeToAnnounce"),
834+
InboundHTLCState::AwaitingAnnouncedRemoteRevoke(_) => (true, "AwaitingAnnouncedRemoteRevoke"),
835+
InboundHTLCState::Committed => (true, "Committed"),
836+
InboundHTLCState::LocalRemoved(_) => (!generated_by_local, "LocalRemoved"),
831837
};
832838

833839
if include {
834-
add_htlc_output!(htlc, false, None);
840+
add_htlc_output!(htlc, false, None, state_name);
835841
remote_htlc_total_msat += htlc.amount_msat;
836842
} else {
843+
log_trace!(self, " ...not including inbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, log_bytes!(htlc.payment_hash.0), htlc.amount_msat, state_name);
837844
match &htlc.state {
838845
&InboundHTLCState::LocalRemoved(ref reason) => {
839846
if generated_by_local {
@@ -848,18 +855,19 @@ impl Channel {
848855
}
849856

850857
for ref htlc in self.pending_outbound_htlcs.iter() {
851-
let include = match htlc.state {
852-
OutboundHTLCState::LocalAnnounced(_) => generated_by_local,
853-
OutboundHTLCState::Committed => true,
854-
OutboundHTLCState::RemoteRemoved => generated_by_local,
855-
OutboundHTLCState::AwaitingRemoteRevokeToRemove => generated_by_local,
856-
OutboundHTLCState::AwaitingRemovedRemoteRevoke => false,
858+
let (include, state_name) = match htlc.state {
859+
OutboundHTLCState::LocalAnnounced(_) => (generated_by_local, "LocalAnnounced"),
860+
OutboundHTLCState::Committed => (true, "Committed"),
861+
OutboundHTLCState::RemoteRemoved => (generated_by_local, "RemoteRemoved"),
862+
OutboundHTLCState::AwaitingRemoteRevokeToRemove => (generated_by_local, "AwaitingRemoteRevokeToRemove"),
863+
OutboundHTLCState::AwaitingRemovedRemoteRevoke => (false, "AwaitingRemovedRemoteRevoke"),
857864
};
858865

859866
if include {
860-
add_htlc_output!(htlc, true, Some(&htlc.source));
867+
add_htlc_output!(htlc, true, Some(&htlc.source), state_name);
861868
local_htlc_total_msat += htlc.amount_msat;
862869
} else {
870+
log_trace!(self, " ...not including outbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, log_bytes!(htlc.payment_hash.0), htlc.amount_msat, state_name);
863871
match htlc.state {
864872
OutboundHTLCState::AwaitingRemoteRevokeToRemove|OutboundHTLCState::AwaitingRemovedRemoteRevoke => {
865873
if htlc.fail_reason.is_none() {
@@ -1217,6 +1225,7 @@ impl Channel {
12171225
_ => {}
12181226
}
12191227
}
1228+
log_trace!(self, "Adding HTLC claim to holding_cell! Current state: {}", self.channel_state);
12201229
self.holding_cell_htlc_updates.push(HTLCUpdateAwaitingACK::ClaimHTLC {
12211230
payment_preimage: payment_preimage_arg, htlc_id: htlc_id_arg,
12221231
});
@@ -1230,6 +1239,7 @@ impl Channel {
12301239
debug_assert!(false, "Have an inbound HTLC we tried to claim before it was fully committed to");
12311240
return Ok((None, Some(self.channel_monitor.clone())));
12321241
}
1242+
log_trace!(self, "Upgrading HTLC {} to LocalRemoved with a Fulfill!", log_bytes!(htlc.payment_hash.0));
12331243
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::Fulfill(payment_preimage_arg.clone()));
12341244
}
12351245

@@ -1712,6 +1722,7 @@ impl Channel {
17121722
};
17131723
let local_commitment_txid = local_commitment_tx.0.txid();
17141724
let local_sighash = hash_to_message!(&bip143::SighashComponents::new(&local_commitment_tx.0).sighash_all(&local_commitment_tx.0.input[0], &funding_script, self.channel_value_satoshis)[..]);
1725+
log_trace!(self, "Checking commitment tx signature {} by key {} against tx {} with redeemscript {}", log_bytes!(msg.signature.serialize_compact()[..]), log_bytes!(self.their_funding_pubkey.unwrap().serialize()), encode::serialize_hex(&local_commitment_tx.0), encode::serialize_hex(&funding_script));
17151726
secp_check!(self.secp_ctx.verify(&local_sighash, &msg.signature, &self.their_funding_pubkey.unwrap()), "Invalid commitment tx signature from peer");
17161727

17171728
//If channel fee was updated by funder confirm funder can afford the new fee rate when applied to the current local commitment transaction
@@ -1737,6 +1748,7 @@ impl Channel {
17371748
if let Some(_) = htlc.transaction_output_index {
17381749
let mut htlc_tx = self.build_htlc_transaction(&local_commitment_txid, &htlc, true, &local_keys, feerate_per_kw);
17391750
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc, &local_keys);
1751+
log_trace!(self, "Checking HTLC tx signature {} by key {} against tx {} with redeemscript {}", log_bytes!(msg.htlc_signatures[idx].serialize_compact()[..]), log_bytes!(local_keys.b_htlc_key.serialize()), encode::serialize_hex(&htlc_tx), encode::serialize_hex(&htlc_redeemscript));
17401752
let htlc_sighash = hash_to_message!(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0], &htlc_redeemscript, htlc.amount_msat / 1000)[..]);
17411753
secp_check!(self.secp_ctx.verify(&htlc_sighash, &msg.htlc_signatures[idx], &local_keys.b_htlc_key), "Invalid HTLC tx signature from peer");
17421754
let htlc_sig = if htlc.offered {
@@ -1982,74 +1994,89 @@ impl Channel {
19821994
self.monitor_pending_order = None;
19831995
}
19841996

1997+
log_trace!(self, "Updating HTLCs on receipt of RAA...");
19851998
let mut to_forward_infos = Vec::new();
19861999
let mut revoked_htlcs = Vec::new();
19872000
let mut update_fail_htlcs = Vec::new();
19882001
let mut update_fail_malformed_htlcs = Vec::new();
19892002
let mut require_commitment = false;
19902003
let mut value_to_self_msat_diff: i64 = 0;
1991-
// We really shouldnt have two passes here, but retain gives a non-mutable ref (Rust bug)
1992-
self.pending_inbound_htlcs.retain(|htlc| {
1993-
if let &InboundHTLCState::LocalRemoved(ref reason) = &htlc.state {
1994-
if let &InboundHTLCRemovalReason::Fulfill(_) = reason {
1995-
value_to_self_msat_diff += htlc.amount_msat as i64;
1996-
}
1997-
false
1998-
} else { true }
1999-
});
2000-
self.pending_outbound_htlcs.retain(|htlc| {
2001-
if let OutboundHTLCState::AwaitingRemovedRemoteRevoke = htlc.state {
2002-
if let Some(reason) = htlc.fail_reason.clone() { // We really want take() here, but, again, non-mut ref :(
2003-
revoked_htlcs.push((htlc.source.clone(), htlc.payment_hash, reason));
2004-
} else {
2005-
// They fulfilled, so we sent them money
2006-
value_to_self_msat_diff -= htlc.amount_msat as i64;
2007-
}
2008-
false
2009-
} else { true }
2010-
});
2011-
for htlc in self.pending_inbound_htlcs.iter_mut() {
2012-
let swap = if let &InboundHTLCState::AwaitingRemoteRevokeToAnnounce(_) = &htlc.state {
2013-
true
2014-
} else if let &InboundHTLCState::AwaitingAnnouncedRemoteRevoke(_) = &htlc.state {
2015-
true
2016-
} else { false };
2017-
if swap {
2018-
let mut state = InboundHTLCState::Committed;
2019-
mem::swap(&mut state, &mut htlc.state);
2020-
2021-
if let InboundHTLCState::AwaitingRemoteRevokeToAnnounce(forward_info) = state {
2022-
htlc.state = InboundHTLCState::AwaitingAnnouncedRemoteRevoke(forward_info);
2023-
require_commitment = true;
2024-
} else if let InboundHTLCState::AwaitingAnnouncedRemoteRevoke(forward_info) = state {
2025-
match forward_info {
2026-
PendingHTLCStatus::Fail(fail_msg) => {
2027-
require_commitment = true;
2028-
match fail_msg {
2029-
HTLCFailureMsg::Relay(msg) => {
2030-
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(msg.reason.clone()));
2031-
update_fail_htlcs.push(msg)
2032-
},
2033-
HTLCFailureMsg::Malformed(msg) => {
2034-
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailMalformed((msg.sha256_of_onion, msg.failure_code)));
2035-
update_fail_malformed_htlcs.push(msg)
2036-
},
2004+
2005+
{
2006+
// Take references explicitly so that we can hold multiple references to self.
2007+
let pending_inbound_htlcs: &mut Vec<_> = &mut self.pending_inbound_htlcs;
2008+
let pending_outbound_htlcs: &mut Vec<_> = &mut self.pending_outbound_htlcs;
2009+
let logger = LogHolder { logger: &self.logger };
2010+
2011+
// We really shouldnt have two passes here, but retain gives a non-mutable ref (Rust bug)
2012+
pending_inbound_htlcs.retain(|htlc| {
2013+
if let &InboundHTLCState::LocalRemoved(ref reason) = &htlc.state {
2014+
log_trace!(logger, " ...removing inbound LocalRemoved {}", log_bytes!(htlc.payment_hash.0));
2015+
if let &InboundHTLCRemovalReason::Fulfill(_) = reason {
2016+
value_to_self_msat_diff += htlc.amount_msat as i64;
2017+
}
2018+
false
2019+
} else { true }
2020+
});
2021+
pending_outbound_htlcs.retain(|htlc| {
2022+
if let OutboundHTLCState::AwaitingRemovedRemoteRevoke = htlc.state {
2023+
log_trace!(logger, " ...removing outbound AwaitingRemovedRemoteRevoke {}", log_bytes!(htlc.payment_hash.0));
2024+
if let Some(reason) = htlc.fail_reason.clone() { // We really want take() here, but, again, non-mut ref :(
2025+
revoked_htlcs.push((htlc.source.clone(), htlc.payment_hash, reason));
2026+
} else {
2027+
// They fulfilled, so we sent them money
2028+
value_to_self_msat_diff -= htlc.amount_msat as i64;
2029+
}
2030+
false
2031+
} else { true }
2032+
});
2033+
for htlc in pending_inbound_htlcs.iter_mut() {
2034+
let swap = if let &InboundHTLCState::AwaitingRemoteRevokeToAnnounce(_) = &htlc.state {
2035+
log_trace!(logger, " ...promoting inbound AwaitingRemoteRevokeToAnnounce {} to Committed", log_bytes!(htlc.payment_hash.0));
2036+
true
2037+
} else if let &InboundHTLCState::AwaitingAnnouncedRemoteRevoke(_) = &htlc.state {
2038+
log_trace!(logger, " ...promoting inbound AwaitingAnnouncedRemoteRevoke {} to Committed", log_bytes!(htlc.payment_hash.0));
2039+
true
2040+
} else { false };
2041+
if swap {
2042+
let mut state = InboundHTLCState::Committed;
2043+
mem::swap(&mut state, &mut htlc.state);
2044+
2045+
if let InboundHTLCState::AwaitingRemoteRevokeToAnnounce(forward_info) = state {
2046+
htlc.state = InboundHTLCState::AwaitingAnnouncedRemoteRevoke(forward_info);
2047+
require_commitment = true;
2048+
} else if let InboundHTLCState::AwaitingAnnouncedRemoteRevoke(forward_info) = state {
2049+
match forward_info {
2050+
PendingHTLCStatus::Fail(fail_msg) => {
2051+
require_commitment = true;
2052+
match fail_msg {
2053+
HTLCFailureMsg::Relay(msg) => {
2054+
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailRelay(msg.reason.clone()));
2055+
update_fail_htlcs.push(msg)
2056+
},
2057+
HTLCFailureMsg::Malformed(msg) => {
2058+
htlc.state = InboundHTLCState::LocalRemoved(InboundHTLCRemovalReason::FailMalformed((msg.sha256_of_onion, msg.failure_code)));
2059+
update_fail_malformed_htlcs.push(msg)
2060+
},
2061+
}
2062+
},
2063+
PendingHTLCStatus::Forward(forward_info) => {
2064+
to_forward_infos.push((forward_info, htlc.htlc_id));
2065+
htlc.state = InboundHTLCState::Committed;
20372066
}
2038-
},
2039-
PendingHTLCStatus::Forward(forward_info) => {
2040-
to_forward_infos.push((forward_info, htlc.htlc_id));
2041-
htlc.state = InboundHTLCState::Committed;
20422067
}
20432068
}
20442069
}
20452070
}
2046-
}
2047-
for htlc in self.pending_outbound_htlcs.iter_mut() {
2048-
if let OutboundHTLCState::LocalAnnounced(_) = htlc.state {
2049-
htlc.state = OutboundHTLCState::Committed;
2050-
} else if let OutboundHTLCState::AwaitingRemoteRevokeToRemove = htlc.state {
2051-
htlc.state = OutboundHTLCState::AwaitingRemovedRemoteRevoke;
2052-
require_commitment = true;
2071+
for htlc in pending_outbound_htlcs.iter_mut() {
2072+
if let OutboundHTLCState::LocalAnnounced(_) = htlc.state {
2073+
log_trace!(logger, " ...promoting outbound LocalAnnounced {} to Committed", log_bytes!(htlc.payment_hash.0));
2074+
htlc.state = OutboundHTLCState::Committed;
2075+
} else if let OutboundHTLCState::AwaitingRemoteRevokeToRemove = htlc.state {
2076+
log_trace!(logger, " ...promoting outbound AwaitingRemoteRevokeToRemove {} to AwaitingRemovedRemoteRevoke", log_bytes!(htlc.payment_hash.0));
2077+
htlc.state = OutboundHTLCState::AwaitingRemovedRemoteRevoke;
2078+
require_commitment = true;
2079+
}
20532080
}
20542081
}
20552082
self.value_to_self_msat = (self.value_to_self_msat as i64 + value_to_self_msat_diff) as u64;
@@ -2346,6 +2373,8 @@ impl Channel {
23462373
}
23472374
}
23482375

2376+
log_trace!(self, "Regenerated latest commitment update with {} update_adds, {} update_fulfills, {} update_fails, and {} update_fail_malformeds",
2377+
update_add_htlcs.len(), update_fulfill_htlcs.len(), update_fail_htlcs.len(), update_fail_malformed_htlcs.len());
23492378
msgs::CommitmentUpdate {
23502379
update_add_htlcs, update_fulfill_htlcs, update_fail_htlcs, update_fail_malformed_htlcs,
23512380
update_fee: None, //TODO: We need to support re-generating any update_fees in the last commitment_signed!
@@ -3320,6 +3349,7 @@ impl Channel {
33203349
let remote_commitment_txid = remote_commitment_tx.0.txid();
33213350
let remote_sighash = hash_to_message!(&bip143::SighashComponents::new(&remote_commitment_tx.0).sighash_all(&remote_commitment_tx.0.input[0], &funding_script, self.channel_value_satoshis)[..]);
33223351
let our_sig = self.secp_ctx.sign(&remote_sighash, &self.local_keys.funding_key);
3352+
log_trace!(self, "Signing remote commitment tx {} with redeemscript {} with pubkey {} -> {}", encode::serialize_hex(&remote_commitment_tx.0), encode::serialize_hex(&funding_script), log_bytes!(PublicKey::from_secret_key(&self.secp_ctx, &self.local_keys.funding_key).serialize()), log_bytes!(our_sig.serialize_compact()[..]));
33233353

33243354
let mut htlc_sigs = Vec::with_capacity(remote_commitment_tx.1);
33253355
for &(ref htlc, _) in remote_commitment_tx.2.iter() {
@@ -3329,6 +3359,7 @@ impl Channel {
33293359
let htlc_sighash = hash_to_message!(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0], &htlc_redeemscript, htlc.amount_msat / 1000)[..]);
33303360
let our_htlc_key = secp_check!(chan_utils::derive_private_key(&self.secp_ctx, &remote_keys.per_commitment_point, &self.local_keys.htlc_base_key), "Derived invalid key, peer is maliciously selecting parameters");
33313361
htlc_sigs.push(self.secp_ctx.sign(&htlc_sighash, &our_htlc_key));
3362+
log_trace!(self, "Signing remote HTLC tx {} with redeemscript {} with pubkey {} -> {}", encode::serialize_hex(&htlc_tx), encode::serialize_hex(&htlc_redeemscript), log_bytes!(PublicKey::from_secret_key(&self.secp_ctx, &our_htlc_key).serialize()), log_bytes!(htlc_sigs.last().unwrap().serialize_compact()[..]));
33323363
}
33333364
}
33343365

src/ln/channelmanager.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ macro_rules! handle_monitor_err {
457457
($self: ident, $err: expr, $channel_state: expr, $entry: expr, $action_type: path, $resend_raa: expr, $resend_commitment: expr, $failed_forwards: expr, $failed_fails: expr) => {
458458
match $err {
459459
ChannelMonitorUpdateErr::PermanentFailure => {
460+
log_error!($self, "Closing channel {} due to monitor update PermanentFailure", log_bytes!($entry.key()[..]));
460461
let (channel_id, mut chan) = $entry.remove_entry();
461462
if let Some(short_id) = chan.get_short_channel_id() {
462463
$channel_state.short_to_id.remove(&short_id);
@@ -474,6 +475,18 @@ macro_rules! handle_monitor_err {
474475
res
475476
},
476477
ChannelMonitorUpdateErr::TemporaryFailure => {
478+
log_info!($self, "Disabling channel {} due to monitor update TemporaryFailure. On restore will send {} and process {} forwards and {} fails",
479+
log_bytes!($entry.key()[..]),
480+
if $resend_commitment && $resend_raa {
481+
match $action_type {
482+
RAACommitmentOrder::CommitmentFirst => { "commitment then RAA" },
483+
RAACommitmentOrder::RevokeAndACKFirst => { "RAA then commitment" },
484+
}
485+
} else if $resend_commitment { "commitment" }
486+
else if $resend_raa { "RAA" }
487+
else { "nothing" },
488+
(&$failed_forwards as &Vec<(PendingForwardHTLCInfo, u64)>).len(),
489+
(&$failed_fails as &Vec<(HTLCSource, PaymentHash, HTLCFailReason)>).len());
477490
if !$resend_commitment {
478491
debug_assert!($action_type == RAACommitmentOrder::RevokeAndACKFirst || !$resend_raa);
479492
}

src/ln/onion_utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use util::{byte_utils, internal_traits};
55
use util::chacha20::ChaCha20;
66
use util::errors::{self, APIError};
77
use util::ser::{Readable, Writeable};
8-
use util::logger::Logger;
8+
use util::logger::{Logger, LogHolder};
99

1010
use bitcoin_hashes::{Hash, HashEngine};
1111
use bitcoin_hashes::cmp::fixed_time_eq;
@@ -265,7 +265,6 @@ pub(super) fn build_first_hop_failure_packet(shared_secret: &[u8], failure_type:
265265
encrypt_failure_packet(shared_secret, &failure_packet.encode()[..])
266266
}
267267

268-
struct LogHolder<'a> { logger: &'a Arc<Logger> }
269268
/// Process failure we got back from upstream on a payment we sent (implying htlc_source is an
270269
/// OutboundRoute).
271270
/// Returns update, a boolean indicating that the payment itself failed, and the error code.

src/util/logger.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
1717
use std::cmp;
1818
use std::fmt;
19+
use std::sync::Arc;
1920

2021
static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"];
2122

@@ -127,6 +128,8 @@ pub trait Logger: Sync + Send {
127128
fn log(&self, record: &Record);
128129
}
129130

131+
pub(crate) struct LogHolder<'a> { pub(crate) logger: &'a Arc<Logger> }
132+
130133
#[cfg(test)]
131134
mod tests {
132135
use util::logger::{Logger, Level};

0 commit comments

Comments
 (0)