Don't query modern Ledger wallet app version with deprecated payload size
This commit is contained in:
parent
bc7adb97ed
commit
dff8242887
|
@ -241,14 +241,15 @@ impl LedgerWallet {
|
||||||
Ok(message)
|
Ok(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_apdu(
|
fn _send_apdu(
|
||||||
&self,
|
&self,
|
||||||
command: u8,
|
command: u8,
|
||||||
p1: u8,
|
p1: u8,
|
||||||
p2: u8,
|
p2: u8,
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
|
outdated_app: bool,
|
||||||
) -> Result<Vec<u8>, RemoteWalletError> {
|
) -> Result<Vec<u8>, RemoteWalletError> {
|
||||||
self.write(command, p1, p2, data, self.outdated_app())?;
|
self.write(command, p1, p2, data, outdated_app)?;
|
||||||
if p1 == P1_CONFIRM && is_last_part(p2) {
|
if p1 == P1_CONFIRM && is_last_part(p2) {
|
||||||
println!(
|
println!(
|
||||||
"Waiting for your approval on {} {}",
|
"Waiting for your approval on {} {}",
|
||||||
|
@ -263,8 +264,18 @@ impl LedgerWallet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn send_apdu(
|
||||||
|
&self,
|
||||||
|
command: u8,
|
||||||
|
p1: u8,
|
||||||
|
p2: u8,
|
||||||
|
data: &[u8],
|
||||||
|
) -> Result<Vec<u8>, RemoteWalletError> {
|
||||||
|
self._send_apdu(command, p1, p2, data, self.outdated_app())
|
||||||
|
}
|
||||||
|
|
||||||
fn get_firmware_version(&self) -> Result<FirmwareVersion, RemoteWalletError> {
|
fn get_firmware_version(&self) -> Result<FirmwareVersion, RemoteWalletError> {
|
||||||
if let Ok(version) = self.send_apdu(commands::GET_APP_CONFIGURATION, 0, 0, &[]) {
|
if let Ok(version) = self._send_apdu(commands::GET_APP_CONFIGURATION, 0, 0, &[], false) {
|
||||||
if version.len() != 5 {
|
if version.len() != 5 {
|
||||||
return Err(RemoteWalletError::Protocol("Version packet size mismatch"));
|
return Err(RemoteWalletError::Protocol("Version packet size mismatch"));
|
||||||
}
|
}
|
||||||
|
@ -274,7 +285,8 @@ impl LedgerWallet {
|
||||||
version[4].into(),
|
version[4].into(),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
let version = self.send_apdu(commands::DEPRECATED_GET_APP_CONFIGURATION, 0, 0, &[])?;
|
let version =
|
||||||
|
self._send_apdu(commands::DEPRECATED_GET_APP_CONFIGURATION, 0, 0, &[], true)?;
|
||||||
if version.len() != 4 {
|
if version.len() != 4 {
|
||||||
return Err(RemoteWalletError::Protocol("Version packet size mismatch"));
|
return Err(RemoteWalletError::Protocol("Version packet size mismatch"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue