Skip to content

Commit

Permalink
make wallet migration recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
OBorce committed Jan 10, 2024
1 parent 572cbb9 commit 4697182
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions wallet/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,9 @@ impl<B: storage::Backend> Wallet<B> {
WALLET_VERSION_UNINITIALIZED => return Err(WalletError::WalletNotInitialized),
WALLET_VERSION_V1 => {
Self::migration_v2(db, chain_config.clone())?;
Self::migration_v3(db, chain_config)?;
Self::migration_v4(db)?;
}
WALLET_VERSION_V2 => {
Self::migration_v3(db, chain_config)?;
Self::migration_v4(db)?;
Self::migration_v3(db, chain_config.clone())?;
}
WALLET_VERSION_V3 => {
Self::migration_v4(db)?;
Expand All @@ -383,7 +380,7 @@ impl<B: storage::Backend> Wallet<B> {
}
}

Ok(())
Self::check_and_migrate_db(db, chain_config)
}

fn validate_chain_info(
Expand Down
4 changes: 2 additions & 2 deletions wallet/wallet-controller/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ impl<T: NodeInterface + Clone + Send + Sync + 'static, W: WalletEvents> Controll
self.wallet.lock_wallet().map_err(ControllerError::WalletError)
}

/// Locks the wallet by making the encrypted private keys inaccessible.
/// Sets the lookahead size for key generation
///
/// # Returns
///
/// This method returns an error if the wallet is not encrypted.
/// This method returns an error if you try to set lookahead size to 0
pub fn set_lookahead_size(&mut self, lookahead_size: u32) -> Result<(), ControllerError<T>> {
utils::ensure!(lookahead_size > 0, ControllerError::InvalidLookaheadSize);

Expand Down

0 comments on commit 4697182

Please sign in to comment.