Skip to content

Commit 9e4f172

Browse files
committed
the different rust versions are a balancing act, and I can't juggle
1 parent ad9b687 commit 9e4f172

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,14 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
467467
while peer.pending_read_buffer.len() > 0 {
468468

469469
let mut conduit_option = None;
470+
let mut remote_pubkey_option = None;
470471

471472
if let &mut PeerState::Handshake(ref mut handshake) = &mut peer.encryptor {
472473
let (response, conduit, remote_pubkey) = handshake.process_act(&peer.pending_read_buffer, None).unwrap();
473474
peer.pending_read_buffer.drain(..); // we read it all
474475

475476
if let Some(key) = remote_pubkey {
476-
peer.their_node_id.replace(key);
477+
remote_pubkey_option = Some(key);
477478
}
478479

479480
peer.pending_outbound_buffer.push_back(response);
@@ -482,6 +483,10 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
482483
}
483484
}
484485

486+
if let Some(key) = remote_pubkey_option {
487+
peer.their_node_id = Some(key);
488+
}
489+
485490
if let Some(conduit) = conduit_option {
486491
// Rust 1.22 does not allow assignment in a borrowed context, even if mutable
487492
peer.encryptor = PeerState::Connected(conduit);

0 commit comments

Comments
 (0)