Use explicit arguments for internal `suggest_scan_ranges` helper
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
ed4b6dc9b9
commit
2c0acac1bd
|
@ -57,7 +57,7 @@ use zcash_client_backend::{
|
|||
data_api::{
|
||||
self,
|
||||
chain::{BlockSource, CommitmentTreeRoot},
|
||||
scanning::ScanRange,
|
||||
scanning::{ScanPriority, ScanRange},
|
||||
BlockMetadata, DecryptedTransaction, NullifierQuery, PoolType, Recipient, ScannedBlock,
|
||||
SentTransaction, ShieldedProtocol, WalletCommitmentTrees, WalletRead, WalletWrite,
|
||||
SAPLING_SHARD_HEIGHT,
|
||||
|
@ -173,7 +173,7 @@ impl<C: Borrow<rusqlite::Connection>, P: consensus::Parameters> WalletRead for W
|
|||
}
|
||||
|
||||
fn suggest_scan_ranges(&self) -> Result<Vec<ScanRange>, Self::Error> {
|
||||
wallet::scanning::suggest_scan_ranges(self.conn.borrow(), None)
|
||||
wallet::scanning::suggest_scan_ranges(self.conn.borrow(), ScanPriority::Historic)
|
||||
.map_err(SqliteClientError::from)
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ pub(crate) fn priority_code(priority: &ScanPriority) -> i64 {
|
|||
|
||||
pub(crate) fn suggest_scan_ranges(
|
||||
conn: &rusqlite::Connection,
|
||||
min_priority: Option<ScanPriority>,
|
||||
min_priority: ScanPriority,
|
||||
) -> Result<Vec<ScanRange>, SqliteClientError> {
|
||||
let mut stmt_scan_ranges = conn.prepare_cached(
|
||||
"SELECT block_range_start, block_range_end, priority
|
||||
|
@ -84,9 +84,8 @@ pub(crate) fn suggest_scan_ranges(
|
|||
ORDER BY priority DESC, block_range_end DESC",
|
||||
)?;
|
||||
|
||||
let mut rows = stmt_scan_ranges.query(named_params![
|
||||
":min_priority": priority_code(&min_priority.unwrap_or(ScanPriority::Historic))
|
||||
])?;
|
||||
let mut rows =
|
||||
stmt_scan_ranges.query(named_params![":min_priority": priority_code(&min_priority)])?;
|
||||
|
||||
let mut result = vec![];
|
||||
while let Some(row) = rows.next()? {
|
||||
|
@ -1066,7 +1065,7 @@ mod tests {
|
|||
|
||||
// Check that the scanned range has been properly persisted
|
||||
assert_matches!(
|
||||
suggest_scan_ranges(&db_data.conn, Some(Scanned)),
|
||||
suggest_scan_ranges(&db_data.conn, Scanned),
|
||||
Ok(scan_ranges) if scan_ranges == vec![
|
||||
scan_range((sap_active + 300)..(sap_active + 310), FoundNote),
|
||||
scan_range((sap_active + 310)..(sap_active + 320), Scanned)
|
||||
|
|
Loading…
Reference in New Issue