diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 899cec63..d77cdc1f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -4472,12 +4472,28 @@ void wallet2::check_and_throw_if_self_directed_tx_with_payment_id_requested(cons WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(!has_payment_id, "sending funds to yourself with payment id is not allowed"); } //---------------------------------------------------------------------------------------------------- +void wallet2::check_and_throw_if_auditable_address_is_targeted_before_hf2(const construct_tx_param& ctp) +{ + if (get_top_block_height() <= m_core_runtime_config.hard_fork_02_starts_after_height) + { + // before HF2 + for (auto& d : ctp.dsts) + { + for (auto& addr : d.addr) + { + WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(!addr.is_auditable(), "sending fund to an auditable address is not supported until HF2, address = " << get_account_address_as_str(addr)); + } + } + } +} +//---------------------------------------------------------------------------------------------------- void wallet2::transfer(const construct_tx_param& ctp, currency::transaction &tx, bool send_to_network, std::string* p_signed_tx_blob_str) { check_and_throw_if_self_directed_tx_with_payment_id_requested(ctp); + check_and_throw_if_auditable_address_is_targeted_before_hf2(ctp); TIME_MEASURE_START(prepare_transaction_time); finalize_tx_param ftp = AUTO_VAL_INIT(ftp); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index fe1dd21e..7a012351 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -904,6 +904,7 @@ private: bool generate_packing_transaction_if_needed(currency::transaction& tx, uint64_t fake_outputs_number); bool store_unsigned_tx_to_file_and_reserve_transfers(const finalize_tx_param& ftp, const std::string& filename, std::string* p_unsigned_tx_blob_str = nullptr); void check_and_throw_if_self_directed_tx_with_payment_id_requested(const construct_tx_param& ctp); + void check_and_throw_if_auditable_address_is_targeted_before_hf2(const construct_tx_param& ctp); void push_new_block_id(const crypto::hash& id, uint64_t height); bool lookup_item_around(uint64_t i, std::pair& result); //void get_short_chain_history(std::list& ids);