Skip to content

Commit 8a072d1

Browse files
committed
fix: crc feedback
1 parent b897380 commit 8a072d1

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

stacks-signer/src/signerdb.rs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,27 +1057,6 @@ impl SignerDb {
10571057
Ok(())
10581058
}
10591059

1060-
/// For tests, fetch all pending block validations
1061-
#[cfg(any(test, feature = "testing"))]
1062-
pub fn get_all_pending_block_validations(
1063-
&self,
1064-
) -> Result<Vec<PendingBlockValidation>, DBError> {
1065-
let qry = "SELECT signer_signature_hash, added_time FROM block_validations_pending ORDER BY added_time ASC";
1066-
query_rows(&self.db, qry, params![])
1067-
}
1068-
1069-
/// For tests, check if a pending block validation exists
1070-
#[cfg(any(test, feature = "testing"))]
1071-
pub fn has_pending_block_validation(
1072-
&self,
1073-
sighash: &Sha512Trunc256Sum,
1074-
) -> Result<bool, DBError> {
1075-
let qry = "SELECT signer_signature_hash FROM block_validations_pending WHERE signer_signature_hash = ?1";
1076-
let args = params![sighash.to_string()];
1077-
let sighash_opt: Option<String> = query_row(&self.db, qry, args)?;
1078-
Ok(sighash_opt.is_some())
1079-
}
1080-
10811060
/// Return the start time (epoch time in seconds) and the processing time in milliseconds of the tenure (idenfitied by consensus_hash).
10821061
fn get_tenure_times(&self, tenure: &ConsensusHash) -> Result<(u64, u64), DBError> {
10831062
let query = "SELECT tenure_change, proposed_time, validation_time_ms FROM blocks WHERE consensus_hash = ?1 AND state = ?2 ORDER BY stacks_height DESC";
@@ -1191,6 +1170,29 @@ impl FromRow<PendingBlockValidation> for PendingBlockValidation {
11911170
}
11921171
}
11931172

1173+
#[cfg(any(test, feature = "testing"))]
1174+
impl SignerDb {
1175+
/// For tests, fetch all pending block validations
1176+
pub fn get_all_pending_block_validations(
1177+
&self,
1178+
) -> Result<Vec<PendingBlockValidation>, DBError> {
1179+
let qry = "SELECT signer_signature_hash, added_time FROM block_validations_pending ORDER BY added_time ASC";
1180+
query_rows(&self.db, qry, params![])
1181+
}
1182+
1183+
/// For tests, check if a pending block validation exists
1184+
pub fn has_pending_block_validation(
1185+
&self,
1186+
sighash: &Sha512Trunc256Sum,
1187+
) -> Result<bool, DBError> {
1188+
let qry = "SELECT signer_signature_hash FROM block_validations_pending WHERE signer_signature_hash = ?1";
1189+
let args = params![sighash.to_string()];
1190+
let sighash_opt: Option<String> = query_row(&self.db, qry, args)?;
1191+
Ok(sighash_opt.is_some())
1192+
}
1193+
}
1194+
1195+
/// Tests for SignerDb
11941196
#[cfg(test)]
11951197
mod tests {
11961198
use std::fs;

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7733,9 +7733,13 @@ fn block_validation_response_timeout() {
77337733
);
77347734
}
77357735

7736-
/// Test that, when a signer submit a block validation request and
7737-
/// gets a 429 the signer stores the pending request and submits
7738-
/// it again after the current block validation request finishes.
7736+
/// Test scenario:
7737+
///
7738+
/// - when a signer submits a block validation request and
7739+
/// gets a 429,
7740+
/// - the signer stores the pending request
7741+
/// - and submits it again after the current block validation
7742+
/// request finishes.
77397743
#[test]
77407744
#[ignore]
77417745
fn block_validation_pending_table() {

0 commit comments

Comments
 (0)