diff options
author | luigi1111 <luigi1111w@gmail.com> | 2020-09-07 14:30:41 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2020-09-07 14:30:41 -0500 |
commit | fd657c77066c3f16e69823ee2d2e00601d660c30 (patch) | |
tree | 364e6862dc9b7ff47bb50ae5945b6461ff6caae0 /src | |
parent | Merge pull request #6111 (diff) | |
parent | enable CLSAG support for Trezor client (diff) | |
download | monero-fd657c77066c3f16e69823ee2d2e00601d660c30.tar.xz |
Merge pull request #6798
4e44306 enable CLSAG support for Trezor client (ph4r05)
Diffstat (limited to 'src')
-rw-r--r-- | src/device_trezor/trezor/protocol.cpp | 29 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 2 |
2 files changed, 18 insertions, 13 deletions
diff --git a/src/device_trezor/trezor/protocol.cpp b/src/device_trezor/trezor/protocol.cpp index 25c3d816d..288f3ddca 100644 --- a/src/device_trezor/trezor/protocol.cpp +++ b/src/device_trezor/trezor/protocol.cpp @@ -561,11 +561,6 @@ namespace tx { assign_to_repeatable(tsx_data.mutable_minor_indices(), tx.subaddr_indices.begin(), tx.subaddr_indices.end()); } - // TODO: use HF_VERSION_CLSAG after CLSAG is merged - if (tsx_data.hard_fork() >= 13){ - throw exc::ProtocolException("CLSAG is not yet implemented"); - } - // Rsig decision auto rsig_data = tsx_data.mutable_rsig_data(); m_ct.rsig_type = get_rsig_type(tx.rct_config, tx.splitted_dsts.size()); @@ -1017,14 +1012,24 @@ namespace tx { } } - // CLSAG support comes here once it is merged to the Monero - m_ct.rv->p.MGs.reserve(m_ct.signatures.size()); - for(size_t i = 0; i < m_ct.signatures.size(); ++i) { - rct::mgSig mg; - if (!cn_deserialize(m_ct.signatures[i], mg)) { - throw exc::ProtocolException("Cannot deserialize mg[i]"); + if (m_ct.rv->type == rct::RCTTypeCLSAG){ + m_ct.rv->p.CLSAGs.reserve(m_ct.signatures.size()); + for (size_t i = 0; i < m_ct.signatures.size(); ++i) { + rct::clsag clsag; + if (!cn_deserialize(m_ct.signatures[i], clsag)) { + throw exc::ProtocolException("Cannot deserialize clsag[i]"); + } + m_ct.rv->p.CLSAGs.push_back(clsag); + } + } else { + m_ct.rv->p.MGs.reserve(m_ct.signatures.size()); + for (size_t i = 0; i < m_ct.signatures.size(); ++i) { + rct::mgSig mg; + if (!cn_deserialize(m_ct.signatures[i], mg)) { + throw exc::ProtocolException("Cannot deserialize mg[i]"); + } + m_ct.rv->p.MGs.push_back(mg); } - m_ct.rv->p.MGs.push_back(mg); } m_ct.tx.rct_signatures = *(m_ct.rv); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 3e2ccd1ff..c9289a0b2 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -10682,7 +10682,7 @@ void wallet2::cold_sign_tx(const std::vector<pending_tx>& ptx_vector, signed_tx_ hw::wallet_shim wallet_shim; setup_shim(&wallet_shim, this); aux_data.tx_recipients = dsts_info; - aux_data.bp_version = use_fork_rules(HF_VERSION_SMALLER_BP, -10) ? 2 : 1; + aux_data.bp_version = (use_fork_rules(HF_VERSION_CLSAG, -10) ? 3 : use_fork_rules(HF_VERSION_SMALLER_BP, -10) ? 2 : 1); aux_data.hard_fork = get_current_hard_fork(); dev_cold->tx_sign(&wallet_shim, txs, exported_txs, aux_data); tx_device_aux = aux_data.tx_device_aux; |