diff --git a/stacks-signer/src/signerdb.rs b/stacks-signer/src/signerdb.rs index b5195d68cf..f30c0124c1 100644 --- a/stacks-signer/src/signerdb.rs +++ b/stacks-signer/src/signerdb.rs @@ -856,7 +856,7 @@ impl SignerDb { // If we have no blocks known for this tenure, we will assume it has only JUST started and calculate // our tenure extend timestamp based on the epoch time in secs. let mut tenure_start_timestamp = None; - let mut tenure_process_time_ms = 0; + let mut tenure_process_time_ms = 0_u64; // Note that the globally accepted blocks are already returned in descending order of stacks height, therefore by newest block to oldest block for block_info in self .get_globally_accepted_blocks(consensus_hash) @@ -865,7 +865,9 @@ impl SignerDb { { // Always use the oldest block as our tenure start timestamp tenure_start_timestamp = Some(block_info.proposed_time); - tenure_process_time_ms += block_info.validation_time_ms.unwrap_or(0); + + tenure_process_time_ms = + tenure_process_time_ms.saturating_add(block_info.validation_time_ms.unwrap_or(0)); if block_info .block diff --git a/stacks-signer/src/v0/signer.rs b/stacks-signer/src/v0/signer.rs index 356f2cbedc..ea4a3d812d 100644 --- a/stacks-signer/src/v0/signer.rs +++ b/stacks-signer/src/v0/signer.rs @@ -18,6 +18,8 @@ use std::sync::mpsc::Sender; use std::time::{Duration, Instant}; use blockstack_lib::chainstate::nakamoto::{NakamotoBlock, NakamotoBlockHeader}; +use blockstack_lib::chainstate::stacks::address::StacksAddressExtensions; +use blockstack_lib::chainstate::stacks::TransactionPayload; use blockstack_lib::net::api::postblock_proposal::{ BlockValidateOk, BlockValidateReject, BlockValidateResponse, }; @@ -587,7 +589,20 @@ impl Signer { block_info.signed_self.get_or_insert(get_epoch_time_secs()); } // Record the block validation time - block_info.validation_time_ms = Some(block_validate_ok.validation_time_ms); + let non_bootcode_contract_call_block = block_info.block.txs.iter().any(|tx| { + // We only care about blocks that contain a non bootcode contract call + match &tx.payload { + TransactionPayload::ContractCall(cc) => !cc.address.is_boot_code_addr(), + TransactionPayload::SmartContract(..) => true, + _ => false, + } + }); + if non_bootcode_contract_call_block { + block_info.validation_time_ms = Some(block_validate_ok.validation_time_ms); + } else { + // Ignore purely boot code and stx transfers when calculating the processing/validation time + block_info.validation_time_ms = Some(0); + } let signature = self .private_key