From 64df13519a2e29d28a0c5f2432f71a901d91a736 Mon Sep 17 00:00:00 2001 From: viraladmin <00purple@gmail.com> Date: Thu, 11 Jun 2026 02:26:21 -0600 Subject: [PATCH] bug fixes --- src/torrent/torrenting_system/save_block.rs | 5 +++++ src/verifications/verification_service.rs | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/torrent/torrenting_system/save_block.rs b/src/torrent/torrenting_system/save_block.rs index 666a5fd..388432c 100644 --- a/src/torrent/torrenting_system/save_block.rs +++ b/src/torrent/torrenting_system/save_block.rs @@ -3,6 +3,7 @@ use crate::common::skein::skein_128_hash_bytes; use crate::log::{error, warn}; use crate::miner::flag::is_reorganizing_mode; use crate::records::block_height::get_block_height::get_height; +use crate::records::memory::mempool::ensure_db_connection; use crate::records::record_chain::save::save_block; use crate::records::record_chain::structs::{SaveBlockParams, SaveType}; use crate::records::unpack_block::load_by_binary_data::load_block_from_binary; @@ -102,6 +103,10 @@ pub async fn verify_and_save_block(params: DownloadSave) -> Result<(), String> { return Err("Candidate previous hash does not match torrent metadata.".to_string()); } + ensure_db_connection() + .await + .map_err(|err| format!("Postgres reconnect failed before block verification: {err}"))?; + // Run full block verification before allowing the chain save path to persist the downloaded block. let signatures = match loaded_block .verify(¶ms.db, params.verification_service.clone()) diff --git a/src/verifications/verification_service.rs b/src/verifications/verification_service.rs index f3fff83..66922df 100644 --- a/src/verifications/verification_service.rs +++ b/src/verifications/verification_service.rs @@ -1,7 +1,6 @@ use crate::common::types::Transaction; use crate::rayon::ThreadPool; use crate::rayon::ThreadPoolBuilder; -use crate::records::memory::mempool::ensure_db_connection; use crate::verifications::async_funcs::checks::block_balance::BlockBalanceTracker; use crate::verifications::async_funcs::transactions::verify_transactions; use crate::verifications::sync_funcs::transaction_verify_loop::COUNTER; @@ -104,10 +103,6 @@ impl VerificationService { verify_runtime: Arc, job: VerificationJob, ) -> Result, String> { - ensure_db_connection() - .await - .map_err(|err| format!("Postgres reconnect failed before validation: {err}"))?; - // Transaction verification is split into chunks and processed in parallel, then // merged back into one result list for the caller. let chunk_size = 1000usize;