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

some change #6

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 13 additions & 8 deletions base_layer/core/src/transactions/key_manager/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::{collections::HashMap, ops::Shl};

use blake2::Blake2b;
use digest::consts::U64;
use futures::AsyncReadExt;
use log::*;
use minotari_ledger_wallet_comms::ledger_wallet::get_transport;
#[cfg(feature = "ledger")]
Expand Down Expand Up @@ -194,13 +195,17 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
pub async fn get_public_key_at_key_id(&self, key_id: &TariKeyId) -> Result<PublicKey, KeyManagerServiceError> {
match key_id {
KeyId::Managed { branch, index } => {
let km = self
.key_managers
.get(branch)
.ok_or(KeyManagerServiceError::UnknownKeyBranch)?
.read()
.await;
Ok(km.derive_public_key(*index)?.key)
match branch{
"LedgerNonde" => {}
_ => {let km = self
.key_managers
.get(branch)
.ok_or(KeyManagerServiceError::UnknownKeyBranch)?
.read()
.await;
Ok(km.derive_public_key(*index)?.key)}
}

},
KeyId::Derived { branch, label, index } => {
let public_alpha = match &self.wallet_type {
Expand Down Expand Up @@ -883,7 +888,7 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
let sender_offset_public_key = self.get_public_key_at_key_id(sender_offset_key_id).await?;
// Use the pubkey, but generate the nonce on ledger
let (ephemeral_private_nonce_id, ephemeral_pubkey) = self
.get_next_key(&TransactionKeyManagerBranch::Nonce.get_branch_key())
.get_next_key(&TransactionKeyManagerBranch::MetadataEphemiralNonce.get_branch_key())
.await?;
let receiver_partial_metadata_signature = self
.get_receiver_partial_metadata_signature(
Expand Down
1 change: 1 addition & 0 deletions base_layer/core/src/transactions/key_manager/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub enum TxoStage {
pub enum TransactionKeyManagerBranch {
DataEncryption,
Coinbase,
MetadataEphemiralNonce,
CommitmentMask,
Nonce,
KernelNonce,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ where KM: TransactionKeyManagerInterface
) -> Result<&mut Self, KeyManagerServiceError> {
let (recipient_ephemeral_public_key_nonce, _) = self
.key_manager
.get_next_key(TransactionKeyManagerBranch::Nonce.get_branch_key())
.get_next_key(TransactionKeyManagerBranch::MetadataEphemiralNonce.get_branch_key())
.await?;
let (recipient_sender_offset_key_id, _) = self
.key_manager
Expand Down