Skip to content

Commit

Permalink
fix: keep alpha key constant (#6375)
Browse files Browse the repository at this point in the history
Description
---
FFI now re-uses alpha from previous runs. 
Move DB read of the alpha key from console wallet to wallet lib

Motivation and Context
---
The alpha key should be constant across starts, the FFI creates a new
alpha key on each startup
  • Loading branch information
SWvheerden authored Jun 26, 2024
1 parent 2bd58c2 commit f5e88e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions applications/minotari_console_wallet/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ pub async fn init_wallet(
};

let master_seed = read_or_create_master_seed(recovery_seed.clone(), &wallet_db)?;
let wallet_type = read_or_create_wallet_type(wallet_type, &wallet_db);

let node_identity = match config.wallet.identity_file.as_ref() {
Some(identity_file) => {
Expand Down Expand Up @@ -476,7 +475,7 @@ pub async fn init_wallet(
key_manager_backend,
shutdown_signal,
master_seed,
wallet_type.unwrap(),
wallet_type,
user_agent,
)
.await
Expand Down Expand Up @@ -839,7 +838,7 @@ pub fn prompt_wallet_type(

#[cfg(feature = "ledger")]
{
if prompt("\r\nWould you like to use a connected hardware wallet? (Supported types: Ledger)") {
if prompt("\r\nWould you like to use a connected hardware wallet? (Supported types: Ledger) (Y/n)") {
print!("Scanning for connected Ledger hardware device... ");
match get_transport() {
Ok(hid) => {
Expand Down
3 changes: 2 additions & 1 deletion base_layer/wallet/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ where
key_manager_backend: TKeyManagerBackend,
shutdown_signal: ShutdownSignal,
master_seed: CipherSeed,
wallet_type: WalletType,
wallet_type: Option<WalletType>,
user_agent: String,
) -> Result<Self, WalletError> {
let wallet_type = read_or_create_wallet_type(wallet_type, &wallet_database)?;
let buf_size = cmp::max(WALLET_BUFFER_MIN_SIZE, config.buffer_size);
let (publisher, subscription_factory) = pubsub_connector(buf_size);
let peer_message_subscription_factory = Arc::new(subscription_factory);
Expand Down
2 changes: 1 addition & 1 deletion base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5713,7 +5713,7 @@ pub unsafe extern "C" fn wallet_create(
key_manager_backend,
shutdown.to_signal(),
master_seed,
WalletType::default(),
Some(WalletType::default()),
user_agent,
));

Expand Down

0 comments on commit f5e88e9

Please sign in to comment.