Skip to content
Open
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
8 changes: 4 additions & 4 deletions key-wallet-ffi/src/address_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ fn address_info_to_ffi(info: &AddressInfo) -> FFIAddressInfo {
public_key_len,
index: info.index,
path: path_str,
used: info.used,
used: info.is_used(),
generated_at: info.generated_at,
used_at: info.used_at.unwrap_or(0),
used_at: info.used_at().unwrap_or(0),
tx_count: info.tx_count,
total_received: info.total_received,
total_sent: info.total_sent,
Expand Down Expand Up @@ -879,6 +879,7 @@ pub unsafe extern "C" fn address_info_array_free(infos: *mut *mut FFIAddressInfo
mod tests {
use super::*;
use dash_network::ffi::FFINetwork;
use key_wallet::managed_account::address_pool::AddressState;

#[test]
fn test_address_pool_type_values() {
Expand Down Expand Up @@ -914,9 +915,8 @@ mod tests {
public_key: Some(PublicKeyType::ECDSA(vec![0x02, 0x03, 0x04])),
index: 0,
path: test_path,
used: false,
state: AddressState::Available,
generated_at: 1234567890,
used_at: None,
tx_count: 0,
total_received: 0,
total_sent: 0,
Expand Down
7 changes: 4 additions & 3 deletions key-wallet-ffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,10 @@ impl From<key_wallet::Error> for FFIError {
Error::InvalidNetwork => FFIErrorCode::InvalidNetwork,
Error::InvalidAddress(_) => FFIErrorCode::InvalidAddress,
Error::Serialization(_) => FFIErrorCode::SerializationError,
Error::WatchOnly | Error::CoinJoinNotEnabled | Error::NoKeySource => {
FFIErrorCode::InvalidState
}
Error::InvalidState(_)
| Error::WatchOnly
| Error::CoinJoinNotEnabled
| Error::NoKeySource => FFIErrorCode::InvalidState,
Error::Bip32(_)
| Error::Slip10(_)
| Error::BLS(_)
Expand Down
5 changes: 2 additions & 3 deletions key-wallet-manager/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ mod project_derived_addresses_tests {
use super::*;
use key_wallet::account::StandardAccountType;
use key_wallet::bip32::{ChildNumber, DerivationPath};
use key_wallet::managed_account::address_pool::AddressInfo;
use key_wallet::managed_account::address_pool::{AddressInfo, AddressState};
use std::collections::BTreeMap;

/// Compressed encoding of the secp256k1 generator point (G).
Expand Down Expand Up @@ -488,9 +488,8 @@ mod project_derived_addresses_tests {
public_key: Some(PublicKeyType::ECDSA(pubkey_bytes)),
index,
path,
used: false,
state: AddressState::Available,
generated_at: 0,
used_at: None,
tx_count: 0,
total_received: 0,
total_sent: 0,
Expand Down
3 changes: 3 additions & 0 deletions key-wallet/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub enum Error {
Serialization(String),
/// Invalid parameter
InvalidParameter(String),
/// Internal invariant violated (inconsistent wallet state)
InvalidState(String),
/// Watch-only wallet (no private keys available)
WatchOnly,
/// No key source available for address derivation
Expand All @@ -61,6 +63,7 @@ impl fmt::Display for Error {
Error::CoinJoinNotEnabled => write!(f, "CoinJoin not enabled for this account"),
Error::Serialization(s) => write!(f, "Serialization error: {}", s),
Error::InvalidParameter(s) => write!(f, "Invalid parameter: {}", s),
Error::InvalidState(s) => write!(f, "Invalid state: {}", s),
Error::WatchOnly => write!(f, "Watch-only wallet: private keys not available"),
Error::NoKeySource => write!(f, "No key source available for address derivation"),
}
Expand Down
Loading
Loading