diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-11-01 22:34:02 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-11-01 22:34:02 +0200 |
commit | 7d05e6eab310ac04adde404af63946022a24f2be (patch) | |
tree | 3a38e0c3774dc57eefae1034de047dddc23a154c /src/device | |
parent | Merge pull request #4658 (diff) | |
parent | ringct: use dummy bulletproofs when in fake mode, for speed (diff) | |
download | monero-7d05e6eab310ac04adde404af63946022a24f2be.tar.xz |
Merge pull request #4663
d6937e37 ringct: use dummy bulletproofs when in fake mode, for speed (moneromooo-monero)
Diffstat (limited to 'src/device')
-rw-r--r-- | src/device/device.hpp | 8 | ||||
-rw-r--r-- | src/device/device_default.cpp | 2 | ||||
-rw-r--r-- | src/device/device_ledger.cpp | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/device/device.hpp b/src/device/device.hpp index cb9117650..815a0ab93 100644 --- a/src/device/device.hpp +++ b/src/device/device.hpp @@ -85,7 +85,7 @@ namespace hw { public: - device() {} + device(): mode(NONE) {} device(const device &hwdev) {} virtual ~device() {} @@ -115,7 +115,8 @@ namespace hw { virtual bool connect(void) = 0; virtual bool disconnect(void) = 0; - virtual bool set_mode(device_mode mode) = 0; + virtual bool set_mode(device_mode mode) { this->mode = mode; return true; } + virtual device_mode get_mode() const { return mode; } virtual device_type get_type() const = 0; @@ -202,6 +203,9 @@ namespace hw { virtual bool mlsag_sign(const rct::key &c, const rct::keyV &xx, const rct::keyV &alpha, const size_t rows, const size_t dsRows, rct::keyV &ss) = 0; virtual bool close_tx(void) = 0; + + protected: + device_mode mode; } ; struct reset_mode { diff --git a/src/device/device_default.cpp b/src/device/device_default.cpp index a4f40e041..68f40d91e 100644 --- a/src/device/device_default.cpp +++ b/src/device/device_default.cpp @@ -83,7 +83,7 @@ namespace hw { } bool device_default::set_mode(device_mode mode) { - return true; + return device::set_mode(mode); } /* ======================================================================= */ diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp index d879ee95a..0a86e6987 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -396,7 +396,7 @@ namespace hw { CHECK_AND_ASSERT_THROW_MES(false, " device_ledger::set_mode(unsigned int mode): invalid mode: "<<mode); } MDEBUG("Switch to mode: " <<mode); - return true; + return device::set_mode(mode); } |