Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix clippy #6816

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2878,29 +2878,29 @@ fn run_migrations(db: &LMDBDatabase) -> Result<(), ChainStorageError> {

let k = MetadataKey::MigrationVersion;
let val = lmdb_get::<_, MetadataValue>(&txn, &db.metadata_db, &k.as_u32())?;
let mut n = match val {
let last_migrated_version = match val {
Some(MetadataValue::MigrationVersion(n)) => n,
Some(_) | None => 0,
};
info!(
target: LOG_TARGET,
"Blockchain database is at v{} (required version: {})", n, MIGRATION_VERSION
"Blockchain database is at v{} (required version: {})", last_migrated_version, MIGRATION_VERSION
);
drop(txn);

if n < MIGRATION_VERSION {
for i in last_migrated_version..=MIGRATION_VERSION {
// Add migrations here
if n < 2 {
if i == 1 {
let txn = db.write_transaction()?;
info!(target: LOG_TARGET, "Clearing bad blocks list due to median timestamp bug in nextnet");
let rows_affected = lmdb_clear(&txn, &db.bad_blocks)?;
txn.commit()?;
info!(target: LOG_TARGET, "Removed {} rows from bad blocks", rows_affected);
n = 2;
}

}
if last_migrated_version != MIGRATION_VERSION {
let txn = db.write_transaction()?;
info!(target: LOG_TARGET, "Migrated database to version {}", n);
info!(target: LOG_TARGET, "Migrated database to version {}", MIGRATION_VERSION);
lmdb_replace(
&txn,
&db.metadata_db,
Expand Down
Loading