From 872303f6ad48632a5781e3cd04e2c7eca0da0e12 Mon Sep 17 00:00:00 2001 From: ncoggins Date: Sat, 18 May 2024 08:41:54 +0100 Subject: [PATCH] fixed removal of m_locked_coins entries when PROTOCOL_TX pays out --- src/wallet/wallet2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 {