diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 2d1ca631..e193c6f2 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -3935,7 +3935,7 @@ namespace currency // TODO: @#@# should check for hardfork here? for(auto& el : in.elements) { - if (!visit(0, el.key_image, el.key_offsets)) + if (!visit(0, el.k_image, el.key_offsets)) return false; } return true; diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 0b8de104..bcaeee42 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -364,7 +364,7 @@ bool wallet2::out_get_mixin_attr(const currency::tx_out_v& out_t) } else { - THROW_IF_FALSE_WALLET_INT_ERR_EX(false, "Unexpected type in out_get_mixin_attr"); + THROW_WALLET_CMN_ERR_EX("Unexpected type in out_get_mixin_attr"); } } else if (out_t.type() == typeid(currency::tx_out_zarcanum)) @@ -373,8 +373,10 @@ bool wallet2::out_get_mixin_attr(const currency::tx_out_v& out_t) } else { - THROW_IF_FALSE_WALLET_INT_ERR_EX(false, "Unexpected type in out_get_mixin_attr"); + THROW_WALLET_CMN_ERR_EX("Unexpected type in out_get_mixin_attr"); } + THROW_WALLET_CMN_ERR_EX("Unexpected out type im wallet: " << out_t.type().name()); + return false; } bool out_is_to_zarcanum(const currency::tx_out_v& out_t) @@ -391,8 +393,9 @@ const crypto::public_key& wallet2::out_get_pub_key(const currency::tx_out_v& out { return boost::get(out.target).key; } - else if (out.target.type() == typeid(currency::txout_htlc)) + else { + THROW_IF_FALSE_WALLET_INT_ERR_EX(out.target.type() == typeid(currency::txout_htlc), "Unexpected out type in target wallet: " << out.target.type().name()); THROW_IF_FALSE_WALLET_INT_ERR_EX(htlc_info_list.size() > 0, "Found txout_htlc out but htlc_info_list is empty"); bool hltc_our_out_is_before_expiration = htlc_info_list.front().hltc_our_out_is_before_expiration; htlc_info_list.pop_front(); @@ -404,20 +407,13 @@ const crypto::public_key& wallet2::out_get_pub_key(const currency::tx_out_v& out { return boost::get(out.target).pkey_refund; } - }else - { - THROW_IF_TRUE_WALLET_INT_ERR_EX(false, "Unexpected out type im wallet: " << out.target.type().name()); } } - else if (out_t.type() == typeid(currency::tx_out_zarcanum)) - { - return boost::get(out_t).stealth_address; - } else { - THROW_IF_TRUE_WALLET_INT_ERR_EX(false, "Unexpected out type im wallet: " << out_t.type().name()); + THROW_IF_FALSE_WALLET_INT_ERR_EX(out_t.type() == typeid(currency::tx_out_zarcanum), "Unexpected out type im wallet: " << out_t.type().name()); + return boost::get(out_t).stealth_address; } - } //---------------------------------------------------------------------------------------------------- void wallet2::process_new_transaction(const currency::transaction& tx, uint64_t height, const currency::block& b, const std::vector* pglobal_indexes) diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h index 46c93f30..a5de826d 100644 --- a/src/wallet/wallet_errors.h +++ b/src/wallet/wallet_errors.h @@ -751,3 +751,10 @@ if (cond) LOG_ERROR(" (" << #cond << ") is FALSE. THROW EXCEPTION: wallet_common_error"); \ tools::error::throw_wallet_ex(std::string(__FILE__ ":" STRINGIZE(__LINE__)), ss.str()); \ } +#define THROW_WALLET_CMN_ERR_EX(mess) \ + { \ + std::stringstream ss; \ + ss << mess; \ + LOG_ERROR("THROW EXCEPTION: wallet_common_error"); \ + tools::error::throw_wallet_ex(std::string(__FILE__ ":" STRINGIZE(__LINE__)), ss.str()); \ + } \ No newline at end of file