What changed, and why it matters
This commit changes how Monero wallets estimate how many confirmations a transaction should have before it is considered safe. Previously, the wallet used the actual reward from the most recent block, which can vary. Now it uses a fixed long-term reference reward. This makes the suggested confirmation count more stable and predictable, and removes the need for the wallet to query the latest block reward. It is a correctness/usability fix rather than a direct security patch, though bad confirmation advice could theoretically lead users to trust a transaction before it is fully settled.
No urgent action required. Treat as a routine correctness improvement. Users and integrators relying on suggested_confirmations_threshold should note that values will now be based on the fixed tail subsidy and may differ from previous estimates, especially as block rewards continue to fall. Review whether downstream logic that consumes this threshold makes appropriate assumptions.
Security signals we found
Suggested confirmation threshold now uses a fixed tail-subsidy reference instead of volatile current block reward
Removes wallet dependency on querying last block reward for confirmation advice
Potential prior underestimation of confirmation threshold when block rewards are low
No cryptographic, consensus, or access-control changes
Evidence from the diff
The patch replaces m_wallet->get_last_block_reward() with a compile-time constant reference_reward = FINAL_SUBSIDY_PER_MINUTE * (DIFFICULTY_TARGET_V2 / 60) when computing suggested_confirmations_threshold in both the CLI wallet and the wallet RPC server. The threshold is now ceil(amount / reference_reward). The set_confirmations helper no longer takes a block_reward parameter, and all call sites are updated. This aligns the suggested-confirmation heuristic with Monero’s tail/emission subsidy model instead of the current block reward, which declines over time. The change is defensive: using the actual recent reward could suggest fewer confirmations than appropriate as block rewards drop, potentially nudging users to treat outputs as confirmed sooner than the protocol’s economic security model intends.
Changed components
src/simplewallet/simplewallet.cppsrc/wallet/wallet_rpc_server.cppwallet RPC set_confirmations helperCLI show_transfer confirmation displayInspect captured patch +9 / −11
### src/simplewallet/simplewallet.cpp
@@ -10423,8 +10423,8 @@ bool simple_wallet::show_transfer(const std::vector<std::string> &args)
{
uint64_t bh = std::max(pd.m_unlock_time, pd.m_block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE);
const uint64_t confirmations = last_block_height > pd.m_block_height ? last_block_height - pd.m_block_height : 0;
- uint64_t last_block_reward = m_wallet->get_last_block_reward();
- uint64_t suggested_threshold = last_block_reward ? (pd.m_amount + last_block_reward - 1) / last_block_reward : 0;
+ constexpr uint64_t reference_reward = FINAL_SUBSIDY_PER_MINUTE * (DIFFICULTY_TARGET_V2 / 60);
+ const uint64_t suggested_threshold = pd.m_amount / reference_reward + (pd.m_amount % reference_reward != 0);
if (bh >= last_block_height)
success_msg_writer() << "Locked: " << (bh - last_block_height) << " blocks to unlock";
else if (confirmations < suggested_threshold)
### src/wallet/wallet_rpc_server.cpp
@@ -162,17 +162,15 @@ namespace
return pwd_container;
}
//------------------------------------------------------------------------------------------------------------------------------
- void set_confirmations(tools::wallet_rpc::transfer_entry &entry, uint64_t blockchain_height, uint64_t block_reward, uint64_t unlock_time)
+ void set_confirmations(tools::wallet_rpc::transfer_entry &entry, uint64_t blockchain_height, uint64_t unlock_time)
{
if (entry.height >= blockchain_height || (entry.height == 0 && (!strcmp(entry.type.c_str(), "pending") || !strcmp(entry.type.c_str(), "pool"))))
entry.confirmations = 0;
else
entry.confirmations = blockchain_height - entry.height;
- if (block_reward == 0)
- entry.suggested_confirmations_threshold = 0;
- else
- entry.suggested_confirmations_threshold = (entry.amount + block_reward - 1) / block_reward;
+ constexpr uint64_t reference_reward = FINAL_SUBSIDY_PER_MINUTE * (DIFFICULTY_TARGET_V2 / 60);
+ entry.suggested_confirmations_threshold = entry.amount / reference_reward + (entry.amount % reference_reward != 0);
if (unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER)
{
@@ -548,7 +546,7 @@ namespace tools
entry.subaddr_index = pd.m_subaddr_index;
entry.subaddr_indices.push_back(pd.m_subaddr_index);
entry.address = m_wallet->get_subaddress_as_str(pd.m_subaddr_index);
- set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
+ set_confirmations(entry, m_wallet->get_blockchain_current_height(), pd.m_unlock_time);
}
//------------------------------------------------------------------------------------------------------------------------------
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::confirmed_transfer_details &pd) const
@@ -579,7 +577,7 @@ namespace tools
for (uint32_t i: pd.m_subaddr_indices)
entry.subaddr_indices.push_back({pd.m_subaddr_account, i});
entry.address = m_wallet->get_subaddress_as_str({pd.m_subaddr_account, 0});
- set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
+ set_confirmations(entry, m_wallet->get_blockchain_current_height(), pd.m_unlock_time);
}
//------------------------------------------------------------------------------------------------------------------------------
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd) const
@@ -610,7 +608,7 @@ namespace tools
for (uint32_t i: pd.m_subaddr_indices)
entry.subaddr_indices.push_back({pd.m_subaddr_account, i});
entry.address = m_wallet->get_subaddress_as_str({pd.m_subaddr_account, 0});
- set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_tx.unlock_time);
+ set_confirmations(entry, m_wallet->get_blockchain_current_height(), pd.m_tx.unlock_time);
}
//------------------------------------------------------------------------------------------------------------------------------
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &payment_id, const tools::wallet2::pool_payment_details &ppd) const
@@ -633,7 +631,7 @@ namespace tools
entry.subaddr_index = pd.m_subaddr_index;
entry.subaddr_indices.push_back(pd.m_subaddr_index);
entry.address = m_wallet->get_subaddress_as_str(pd.m_subaddr_index);
- set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
+ set_confirmations(entry, m_wallet->get_blockchain_current_height(), pd.m_unlock_time);
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_get_wallet_info(const wallet_rpc::COMMAND_RPC_GET_WALLET_INFO::request& req, wallet_rpc::COMMAND_RPC_GET_WALLET_INFO::response& res, epee::json_rpc::error& er, const connection_context *ctx)Why this scored 23/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.