mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Log peer features in peer_handler (and check for all req bits)
This commit is contained in:
parent
da6171d50d
commit
fe90e13f84
1 changed files with 18 additions and 0 deletions
|
@ -451,14 +451,32 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
|
|||
16 => {
|
||||
let msg = try_potential_decodeerror!(msgs::Init::read(&mut reader));
|
||||
if msg.global_features.requires_unknown_bits() {
|
||||
log_info!(self, "Peer global features required unknown version bits");
|
||||
return Err(PeerHandleError{ no_connection_possible: true });
|
||||
}
|
||||
if msg.local_features.requires_unknown_bits() {
|
||||
log_info!(self, "Peer local features required unknown version bits");
|
||||
return Err(PeerHandleError{ no_connection_possible: true });
|
||||
}
|
||||
if msg.local_features.requires_data_loss_protect() {
|
||||
log_info!(self, "Peer local features required data_loss_protect");
|
||||
return Err(PeerHandleError{ no_connection_possible: true });
|
||||
}
|
||||
if msg.local_features.requires_upfront_shutdown_script() {
|
||||
log_info!(self, "Peer local features required upfront_shutdown_script");
|
||||
return Err(PeerHandleError{ no_connection_possible: true });
|
||||
}
|
||||
if peer.their_global_features.is_some() {
|
||||
return Err(PeerHandleError{ no_connection_possible: false });
|
||||
}
|
||||
|
||||
log_info!(self, "Received peer Init message: data_loss_protect: {}, initial_routing_sync: {}, upfront_shutdown_script: {}, unkown local flags: {}, unknown global flags: {}",
|
||||
if msg.local_features.supports_data_loss_protect() { "supported" } else { "not supported"},
|
||||
if msg.local_features.initial_routing_sync() { "requested" } else { "not requested" },
|
||||
if msg.local_features.supports_upfront_shutdown_script() { "supported" } else { "not supported"},
|
||||
if msg.local_features.supports_unknown_bits() { "present" } else { "none" },
|
||||
if msg.global_features.supports_unknown_bits() { "present" } else { "none" });
|
||||
|
||||
peer.their_global_features = Some(msg.global_features);
|
||||
peer.their_local_features = Some(msg.local_features);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue