diff options
Diffstat (limited to 'src/device_trezor')
-rw-r--r-- | src/device_trezor/device_trezor.cpp | 16 | ||||
-rw-r--r-- | src/device_trezor/device_trezor.hpp | 4 | ||||
-rw-r--r-- | src/device_trezor/trezor/protocol.cpp | 3 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/device_trezor/device_trezor.cpp b/src/device_trezor/device_trezor.cpp index b1022dd9c..a77f6697f 100644 --- a/src/device_trezor/device_trezor.cpp +++ b/src/device_trezor/device_trezor.cpp @@ -200,6 +200,10 @@ namespace trezor { } } + void device_trezor::display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) { + get_address(index, payment_id, true); + } + /* ======================================================================= */ /* Helpers */ /* ======================================================================= */ @@ -209,8 +213,12 @@ namespace trezor { /* ======================================================================= */ std::shared_ptr<messages::monero::MoneroAddress> device_trezor::get_address( + const boost::optional<cryptonote::subaddress_index> & subaddress, + const boost::optional<crypto::hash8> & payment_id, + bool show_address, const boost::optional<std::vector<uint32_t>> & path, const boost::optional<cryptonote::network_type> & network_type){ + CHECK_AND_ASSERT_THROW_MES(!payment_id || !subaddress || subaddress->is_zero(), "Subaddress cannot be integrated"); TREZOR_AUTO_LOCK_CMD(); require_connected(); device_state_reset_unsafe(); @@ -218,6 +226,14 @@ namespace trezor { auto req = std::make_shared<messages::monero::MoneroGetAddress>(); this->set_msg_addr<messages::monero::MoneroGetAddress>(req.get(), path, network_type); + req->set_show_display(show_address); + if (subaddress){ + req->set_account(subaddress->major); + req->set_minor(subaddress->minor); + } + if (payment_id){ + req->set_payment_id(std::string(payment_id->data, 8)); + } auto response = this->client_exchange<messages::monero::MoneroAddress>(req); MTRACE("Get address response received"); diff --git a/src/device_trezor/device_trezor.hpp b/src/device_trezor/device_trezor.hpp index 0e91847dc..a26a42788 100644 --- a/src/device_trezor/device_trezor.hpp +++ b/src/device_trezor/device_trezor.hpp @@ -110,6 +110,7 @@ namespace trezor { /* ======================================================================= */ bool get_public_address(cryptonote::account_public_address &pubkey) override; bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) override; + void display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) override; /* ======================================================================= */ /* TREZOR PROTOCOL */ @@ -119,6 +120,9 @@ namespace trezor { * Get address. Throws. */ std::shared_ptr<messages::monero::MoneroAddress> get_address( + const boost::optional<cryptonote::subaddress_index> & subaddress = boost::none, + const boost::optional<crypto::hash8> & payment_id = boost::none, + bool show_address = false, const boost::optional<std::vector<uint32_t>> & path = boost::none, const boost::optional<cryptonote::network_type> & network_type = boost::none); diff --git a/src/device_trezor/trezor/protocol.cpp b/src/device_trezor/trezor/protocol.cpp index 5fe08abbe..61e51be14 100644 --- a/src/device_trezor/trezor/protocol.cpp +++ b/src/device_trezor/trezor/protocol.cpp @@ -27,6 +27,7 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // +#include "version.h" #include "protocol.hpp" #include <unordered_map> #include <set> @@ -502,6 +503,8 @@ namespace tx { tsx_data.set_num_inputs(static_cast<google::protobuf::uint32>(tx.sources.size())); tsx_data.set_mixin(static_cast<google::protobuf::uint32>(tx.sources[0].outputs.size() - 1)); tsx_data.set_account(tx.subaddr_account); + tsx_data.set_monero_version(std::string(MONERO_VERSION) + "|" + MONERO_VERSION_TAG); + tsx_data.set_hard_fork(m_aux_data->hard_fork ? m_aux_data->hard_fork.get() : 0); assign_to_repeatable(tsx_data.mutable_minor_indices(), tx.subaddr_indices.begin(), tx.subaddr_indices.end()); // Rsig decision |