Skip to content

Commit 3280b0a

Browse files
fix(spv): clone block header when creating headers message in message_handler
Updated the message_handler to clone the block header when constructing the headers message. This change ensures that the original block header remains intact and avoids potential issues with ownership and borrowing in the processing flow.
1 parent 031a03a commit 3280b0a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

dash-spv/src/client/message_handler.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ impl<
241241

242242
// 1) Ensure header processing and chain tip update for this block
243243
// Route the header through the sequential sync manager as a Headers message
244-
let header = block.header;
245-
let headers_msg = NetworkMessage::Headers(vec![header]);
244+
let headers_msg = NetworkMessage::Headers(vec![block.header.clone()]);
246245
if let Err(e) = self
247246
.sync_manager
248247
.handle_message(headers_msg, &mut *self.network, &mut *self.storage)

0 commit comments

Comments
 (0)