aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobtoht <thotbot@protonmail.com>2021-06-04 15:02:06 +0200
committerselsta <selsta@sent.at>2021-08-07 03:04:04 +0200
commit49beb8da17ff2700ef96eddf9fca9f94ee3582a1 (patch)
treebb6c50cebeee6bf380900b31973d8ca05e76e1fd
parentwallet_api: getPassword (diff)
downloadmonero-49beb8da17ff2700ef96eddf9fca9f94ee3582a1.tar.xz
ledger: use software device if we have view key
-rw-r--r--src/device/device_ledger.cpp14
-rw-r--r--src/device/device_ledger.hpp5
2 files changed, 13 insertions, 6 deletions
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
index 3e0afeb65..b7c6fe94d 100644
--- a/src/device/device_ledger.cpp
+++ b/src/device/device_ledger.cpp
@@ -529,9 +529,7 @@ namespace hw {
}
bool device_ledger::init(void) {
- #ifdef DEBUG_HWDEVICE
this->controle_device = &hw::get_device("default");
- #endif
this->release();
hw_device.init();
MDEBUG( "Device "<<this->id <<" HIDUSB inited");
@@ -750,6 +748,12 @@ namespace hw {
}
crypto::public_key device_ledger::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
+ if (has_view_key) {
+ cryptonote::account_keys keys_{keys};
+ keys_.m_view_secret_key = this->viewkey;
+ return this->controle_device->get_subaddress_spend_public_key(keys_, index);
+ }
+
AUTO_LOCK_CMD();
crypto::public_key D;
@@ -801,6 +805,12 @@ namespace hw {
}
cryptonote::account_public_address device_ledger::get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
+ if (has_view_key) {
+ cryptonote::account_keys keys_{keys};
+ keys_.m_view_secret_key = this->viewkey;
+ return this->controle_device->get_subaddress(keys_, index);
+ }
+
AUTO_LOCK_CMD();
cryptonote::account_public_address address;
diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp
index 5abfaf2be..c9aadbd00 100644
--- a/src/device/device_ledger.hpp
+++ b/src/device/device_ledger.hpp
@@ -192,11 +192,8 @@ namespace hw {
// To speed up blockchain parsing the view key maybe handle here.
crypto::secret_key viewkey;
bool has_view_key;
-
- //extra debug
- #ifdef DEBUG_HWDEVICE
+
device *controle_device;
- #endif
public:
device_ledger();