From acf73ce968b9fa0a67129e47a80710836f088dae Mon Sep 17 00:00:00 2001 From: Revertron Date: Wed, 5 May 2021 14:53:51 +0200 Subject: [PATCH] Fixed block requests. --- src/p2p/network.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p2p/network.rs b/src/p2p/network.rs index 088820f..a205471 100644 --- a/src/p2p/network.rs +++ b/src/p2p/network.rs @@ -453,7 +453,7 @@ fn handle_message(context: Arc>, message: Message, peers: &mut Pe let mut context = context.lock().unwrap(); context.chain.update_max_height(height); info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip()); - State::message(Message::GetBlock { index: height }) + State::message(Message::GetBlock { index: my_height + 1 }) } else if my_height == height && hash.ne(&my_hash) { info!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip()); info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash); @@ -471,7 +471,7 @@ fn handle_message(context: Arc>, message: Message, peers: &mut Pe let mut context = context.lock().unwrap(); context.chain.update_max_height(height); info!("Peer is higher, requesting block {} from {}", height, peer.get_addr().ip()); - State::message(Message::GetBlock { index: height }) + State::message(Message::GetBlock { index: my_height + 1 }) } else if my_height == height && hash.ne(&my_hash) { info!("Hashes are different, requesting block {} from {}", my_height, peer.get_addr().ip()); info!("My hash: {:?}, their hash: {:?}", &my_hash, &hash);