diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 83079cbb7..3e7bd21ce 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2253,7 +2253,11 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote "Failed to calculate uniqueness from origin TX"); // At this point, we need to clear the "locked coins" count, because otherwise we will be counting yield stakes twice in our balance - m_locked_coins.erase(pk_change); + + // Get the output key for the change entry + crypto::public_key pk_locked_coins = crypto::null_pkey; + THROW_WALLET_EXCEPTION_IF(!get_output_public_key(td_origin.m_tx.vout[td_origin.m_internal_output_index], pk_locked_coins), error::wallet_internal_error, "Failed to get output public key for locked coins"); + THROW_WALLET_EXCEPTION_IF(!m_locked_coins.erase(pk_locked_coins), error::wallet_internal_error, "Failed to remove PROTOCOL_TX entry from m_locked_coins"); } else {