diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index f894c9b3..899cec63 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -263,10 +263,15 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t { if (in.type() == typeid(currency::txin_to_key)) { - auto it = m_key_images.find(boost::get(in).k_image); + const currency::txin_to_key& intk = boost::get(in); + + // TODO: check for references to our UTXO (auditability) + // intk.key_offsets; + + auto it = m_key_images.find(intk.k_image); if (it != m_key_images.end()) { - tx_money_spent_in_ins += boost::get(in).amount; + tx_money_spent_in_ins += intk.amount; transfer_details& td = m_transfers[it->second]; uint32_t flags_before = td.m_flags; td.m_flags |= WALLET_TRANSFER_DETAIL_FLAG_SPENT; @@ -340,6 +345,8 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t // obtain key image for this output crypto::key_image ki = currency::null_ki; if (m_watch_only) + { + if (!is_auditable()) { // don't have spend secret key, so we unable to calculate key image for an output // look it up in special container instead @@ -355,6 +362,7 @@ void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t WLT_LOG_L1("can't find pending key image by out pub key: " << otk.key << ", key image temporarily set to null"); } } + } else { // normal wallet, calculate and store key images for own outs diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 7bba0a8b..fe1dd21e 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -631,6 +631,7 @@ namespace tools void enumerate_unconfirmed_transfers(callback_t cb) const; bool is_watch_only() const { return m_watch_only; } + bool is_auditable() const { return m_account.get_public_address().is_auditable(); } void sign_transfer(const std::string& tx_sources_blob, std::string& signed_tx_blob, currency::transaction& tx); void sign_transfer_files(const std::string& tx_sources_file, const std::string& signed_tx_file, currency::transaction& tx); void submit_transfer(const std::string& signed_tx_blob, currency::transaction& tx);