bug fixes

This commit is contained in:
viraladmin 2026-06-11 02:26:21 -06:00
parent f071d728a3
commit 64df13519a
2 changed files with 5 additions and 5 deletions

View File

@ -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(&params.db, params.verification_service.clone())

View File

@ -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<Runtime>,
job: VerificationJob,
) -> Result<Vec<String>, 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;