From 84cf0af197b9b79194ae0e583c5ffd5f454a3212 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Thu, 13 Oct 2022 12:18:36 +0400 Subject: [PATCH] fix(core): dont request full non-tip block if block is empty --- Cargo.lock | 46 +++++++++---------- .../comms_interface/inbound_handlers.rs | 7 +++ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ebdb2384a1..af22725f8c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4594,7 +4594,7 @@ dependencies = [ [[package]] name = "tari_app_grpc" -version = "0.38.6" +version = "0.38.7" dependencies = [ "argon2 0.4.1", "base64 0.13.0", @@ -4619,7 +4619,7 @@ dependencies = [ [[package]] name = "tari_app_utilities" -version = "0.38.6" +version = "0.38.7" dependencies = [ "clap 3.2.22", "config", @@ -4641,7 +4641,7 @@ dependencies = [ [[package]] name = "tari_base_node" -version = "0.38.6" +version = "0.38.7" dependencies = [ "anyhow", "async-trait", @@ -4742,7 +4742,7 @@ dependencies = [ [[package]] name = "tari_common" -version = "0.38.6" +version = "0.38.7" dependencies = [ "anyhow", "blake2 0.9.2", @@ -4770,7 +4770,7 @@ dependencies = [ [[package]] name = "tari_common_sqlite" -version = "0.38.6" +version = "0.38.7" dependencies = [ "diesel", "log", @@ -4779,7 +4779,7 @@ dependencies = [ [[package]] name = "tari_common_types" -version = "0.38.6" +version = "0.38.7" dependencies = [ "base64 0.13.0", "digest 0.9.0", @@ -4795,7 +4795,7 @@ dependencies = [ [[package]] name = "tari_comms" -version = "0.38.6" +version = "0.38.7" dependencies = [ "anyhow", "async-trait", @@ -4845,7 +4845,7 @@ dependencies = [ [[package]] name = "tari_comms_dht" -version = "0.38.6" +version = "0.38.7" dependencies = [ "anyhow", "bitflags 1.3.2", @@ -4891,7 +4891,7 @@ dependencies = [ [[package]] name = "tari_comms_rpc_macros" -version = "0.38.6" +version = "0.38.7" dependencies = [ "futures 0.3.24", "proc-macro2", @@ -4906,7 +4906,7 @@ dependencies = [ [[package]] name = "tari_console_wallet" -version = "0.38.6" +version = "0.38.7" dependencies = [ "base64 0.13.0", "bitflags 1.3.2", @@ -4956,7 +4956,7 @@ dependencies = [ [[package]] name = "tari_core" -version = "0.38.6" +version = "0.38.7" dependencies = [ "async-trait", "bincode", @@ -5044,7 +5044,7 @@ dependencies = [ [[package]] name = "tari_key_manager" -version = "0.38.6" +version = "0.38.7" dependencies = [ "argon2 0.2.4", "arrayvec 0.7.2", @@ -5091,7 +5091,7 @@ dependencies = [ [[package]] name = "tari_merge_mining_proxy" -version = "0.38.6" +version = "0.38.7" dependencies = [ "anyhow", "bincode", @@ -5143,7 +5143,7 @@ dependencies = [ [[package]] name = "tari_miner" -version = "0.38.6" +version = "0.38.7" dependencies = [ "base64 0.13.0", "bufstream", @@ -5179,7 +5179,7 @@ dependencies = [ [[package]] name = "tari_mining_helper_ffi" -version = "0.38.6" +version = "0.38.7" dependencies = [ "hex", "libc", @@ -5196,7 +5196,7 @@ dependencies = [ [[package]] name = "tari_mmr" -version = "0.38.6" +version = "0.38.7" dependencies = [ "bincode", "blake2 0.9.2", @@ -5215,7 +5215,7 @@ dependencies = [ [[package]] name = "tari_p2p" -version = "0.38.6" +version = "0.38.7" dependencies = [ "anyhow", "bytes 0.5.6", @@ -5272,7 +5272,7 @@ dependencies = [ [[package]] name = "tari_service_framework" -version = "0.38.6" +version = "0.38.7" dependencies = [ "anyhow", "async-trait", @@ -5289,7 +5289,7 @@ dependencies = [ [[package]] name = "tari_shutdown" -version = "0.38.6" +version = "0.38.7" dependencies = [ "futures 0.3.24", "tokio", @@ -5297,7 +5297,7 @@ dependencies = [ [[package]] name = "tari_storage" -version = "0.38.6" +version = "0.38.7" dependencies = [ "bincode", "lmdb-zero", @@ -5311,7 +5311,7 @@ dependencies = [ [[package]] name = "tari_test_utils" -version = "0.38.6" +version = "0.38.7" dependencies = [ "futures 0.3.24", "futures-test", @@ -5338,7 +5338,7 @@ dependencies = [ [[package]] name = "tari_wallet" -version = "0.38.6" +version = "0.38.7" dependencies = [ "argon2 0.2.4", "async-trait", @@ -5389,7 +5389,7 @@ dependencies = [ [[package]] name = "tari_wallet_ffi" -version = "0.38.6" +version = "0.38.7" dependencies = [ "cbindgen 0.24.3", "chrono", diff --git a/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs b/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs index 41efee0fba..9d79ed8332 100644 --- a/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs +++ b/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs @@ -455,6 +455,13 @@ where B: BlockchainBackend + 'static current_meta.best_block().to_hex(), source_peer, ); + if excess_sigs.is_empty() { + let block = BlockBuilder::new(header.version) + .with_coinbase_utxo(coinbase_output, coinbase_kernel) + .with_header(header.clone()) + .build(); + return Ok(block); + } metrics::compact_block_tx_misses(header.height).set(excess_sigs.len() as i64); let block = self.request_full_block_from_peer(source_peer, block_hash).await?; return Ok(block);