aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortobtoht <thotbot@protonmail.com>2021-06-04 15:02:06 +0200
committertobtoht <thotbot@protonmail.com>2021-06-04 15:02:06 +0200
commitce40c33a3316d1bb2be2b25a767ac03cc12251b6 (patch)
tree390e770206665f3f99b1940e8fea1b1de49c210c /src
parentMerge pull request #7735 (diff)
downloadmonero-ce40c33a3316d1bb2be2b25a767ac03cc12251b6.tar.xz
ledger: use software device if we have view key
Diffstat (limited to 'src')
-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 384b776ee..a8ca16b73 100644
--- a/src/device/device_ledger.cpp
+++ b/src/device/device_ledger.cpp
@@ -518,9 +518,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");
@@ -739,6 +737,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;
@@ -790,6 +794,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 00ff05ec5..3b6cc505f 100644
--- a/src/device/device_ledger.hpp
+++ b/src/device/device_ledger.hpp
@@ -181,11 +181,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();