projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #965 from TheBlueMatt/2021-06-log-cleanups
[rust-lightning]
/
lightning
/
src
/
ln
/
channelmanager.rs
diff --git
a/lightning/src/ln/channelmanager.rs
b/lightning/src/ln/channelmanager.rs
index a9e714cea7bf245b9bc536f87221ffbcfa57a183..f72c76e7ac3eeb7b3944b3f99c42debeab013a90 100644
(file)
--- a/
lightning/src/ln/channelmanager.rs
+++ b/
lightning/src/ln/channelmanager.rs
@@
-3375,7
+3375,7
@@
impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
}
fn internal_channel_reestablish(&self, counterparty_node_id: &PublicKey, msg: &msgs::ChannelReestablish) -> Result<(), MsgHandleErrInternal> {
}
fn internal_channel_reestablish(&self, counterparty_node_id: &PublicKey, msg: &msgs::ChannelReestablish) -> Result<(), MsgHandleErrInternal> {
- let (htlcs_failed_forward, chan_restoration_res) = {
+ let (htlcs_failed_forward,
need_lnd_workaround,
chan_restoration_res) = {
let mut channel_state_lock = self.channel_state.lock().unwrap();
let channel_state = &mut *channel_state_lock;
let mut channel_state_lock = self.channel_state.lock().unwrap();
let channel_state = &mut *channel_state_lock;
@@
-3396,13
+3396,19
@@
impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
msg,
});
}
msg,
});
}
- (htlcs_failed_forward, handle_chan_restoration_locked!(self, channel_state_lock, channel_state, chan, revoke_and_ack, commitment_update, order, monitor_update_opt, Vec::new(), None, funding_locked))
+ let need_lnd_workaround = chan.get_mut().workaround_lnd_bug_4006.take();
+ (htlcs_failed_forward, need_lnd_workaround,
+ handle_chan_restoration_locked!(self, channel_state_lock, channel_state, chan, revoke_and_ack, commitment_update, order, monitor_update_opt, Vec::new(), None, funding_locked))
},
hash_map::Entry::Vacant(_) => return Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel".to_owned(), msg.channel_id))
}
};
post_handle_chan_restoration!(self, chan_restoration_res);
self.fail_holding_cell_htlcs(htlcs_failed_forward, msg.channel_id);
},
hash_map::Entry::Vacant(_) => return Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel".to_owned(), msg.channel_id))
}
};
post_handle_chan_restoration!(self, chan_restoration_res);
self.fail_holding_cell_htlcs(htlcs_failed_forward, msg.channel_id);
+
+ if let Some(funding_locked_msg) = need_lnd_workaround {
+ self.internal_funding_locked(counterparty_node_id, &funding_locked_msg)?;
+ }
Ok(())
}
Ok(())
}
@@
-4331,22
+4337,22
@@
const MIN_SERIALIZATION_VERSION: u8 = 1;
impl_writeable_tlv_based_enum!(PendingHTLCRouting,
(0, Forward) => {
impl_writeable_tlv_based_enum!(PendingHTLCRouting,
(0, Forward) => {
- (0, onion_packet),
- (2, short_channel_id),
- },
{}, {},
+ (0, onion_packet
, required
),
+ (2, short_channel_id
, required
),
+ },
(1, Receive) => {
(1, Receive) => {
- (0, payment_data),
- (2, incoming_cltv_expiry),
- }
, {}, {}
+ (0, payment_data
, required
),
+ (2, incoming_cltv_expiry
, required
),
+ }
;);
impl_writeable_tlv_based!(PendingHTLCInfo, {
;);
impl_writeable_tlv_based!(PendingHTLCInfo, {
- (0, routing),
- (2, incoming_shared_secret),
- (4, payment_hash),
- (6, amt_to_forward),
- (8, outgoing_cltv_value)
-}
, {}, {}
);
+ (0, routing
, required
),
+ (2, incoming_shared_secret
, required
),
+ (4, payment_hash
, required
),
+ (6, amt_to_forward
, required
),
+ (8, outgoing_cltv_value
, required
)
+});
impl_writeable_tlv_based_enum!(HTLCFailureMsg, ;
(0, Relay),
impl_writeable_tlv_based_enum!(HTLCFailureMsg, ;
(0, Relay),
@@
-4358,60
+4364,58
@@
impl_writeable_tlv_based_enum!(PendingHTLCStatus, ;
);
impl_writeable_tlv_based!(HTLCPreviousHopData, {
);
impl_writeable_tlv_based!(HTLCPreviousHopData, {
- (0, short_channel_id),
- (2, outpoint),
- (4, htlc_id),
- (6, incoming_packet_shared_secret)
-}
, {}, {}
);
+ (0, short_channel_id
, required
),
+ (2, outpoint
, required
),
+ (4, htlc_id
, required
),
+ (6, incoming_packet_shared_secret
, required
)
+});
impl_writeable_tlv_based!(ClaimableHTLC, {
impl_writeable_tlv_based!(ClaimableHTLC, {
- (0, prev_hop),
- (2, value),
- (4, payment_data),
- (6, cltv_expiry),
-}
, {}, {}
);
+ (0, prev_hop
, required
),
+ (2, value
, required
),
+ (4, payment_data
, required
),
+ (6, cltv_expiry
, required
),
+});
impl_writeable_tlv_based_enum!(HTLCSource,
(0, OutboundRoute) => {
impl_writeable_tlv_based_enum!(HTLCSource,
(0, OutboundRoute) => {
- (0, session_priv),
- (2, first_hop_htlc_msat),
- }, {}, {
- (4, path),
- };
+ (0, session_priv, required),
+ (2, first_hop_htlc_msat, required),
+ (4, path, vec_type),
+ }, ;
(1, PreviousHopData)
);
impl_writeable_tlv_based_enum!(HTLCFailReason,
(0, LightningError) => {
(1, PreviousHopData)
);
impl_writeable_tlv_based_enum!(HTLCFailReason,
(0, LightningError) => {
- (0, err),
- },
{}, {},
+ (0, err
, required
),
+ },
(1, Reason) => {
(1, Reason) => {
- (0, failure_code),
- }, {}, {
- (2, data),
+ (0, failure_code, required),
+ (2, data, vec_type),
},
;);
impl_writeable_tlv_based_enum!(HTLCForwardInfo,
(0, AddHTLC) => {
},
;);
impl_writeable_tlv_based_enum!(HTLCForwardInfo,
(0, AddHTLC) => {
- (0, forward_info),
- (2, prev_short_channel_id),
- (4, prev_htlc_id),
- (6, prev_funding_outpoint),
- },
{}, {},
+ (0, forward_info
, required
),
+ (2, prev_short_channel_id
, required
),
+ (4, prev_htlc_id
, required
),
+ (6, prev_funding_outpoint
, required
),
+ },
(1, FailHTLC) => {
(1, FailHTLC) => {
- (0, htlc_id),
- (2, err_packet),
- },
{}, {},
+ (0, htlc_id
, required
),
+ (2, err_packet
, required
),
+ },
;);
impl_writeable_tlv_based!(PendingInboundPayment, {
;);
impl_writeable_tlv_based!(PendingInboundPayment, {
- (0, payment_secret),
- (2, expiry_time),
- (4, user_payment_id),
- (6, payment_preimage),
- (8, min_value_msat),
-}
, {}, {}
);
+ (0, payment_secret
, required
),
+ (2, expiry_time
, required
),
+ (4, user_payment_id
, required
),
+ (6, payment_preimage
, required
),
+ (8, min_value_msat
, required
),
+});
impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable for ChannelManager<Signer, M, T, K, F, L>
where M::Target: chain::Watch<Signer>,
impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable for ChannelManager<Signer, M, T, K, F, L>
where M::Target: chain::Watch<Signer>,
@@
-4506,7
+4510,7
@@
impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable f
session_priv.write(writer)?;
}
session_priv.write(writer)?;
}
- write_tlv_fields!(writer, {}
, {}
);
+ write_tlv_fields!(writer, {});
Ok(())
}
Ok(())
}
@@
-4759,7
+4763,7
@@
impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
}
}
}
}
- read_tlv_fields!(reader, {}
, {}
);
+ read_tlv_fields!(reader, {});
let mut secp_ctx = Secp256k1::new();
secp_ctx.seeded_randomize(&args.keys_manager.get_secure_random_bytes());
let mut secp_ctx = Secp256k1::new();
secp_ctx.seeded_randomize(&args.keys_manager.get_secure_random_bytes());