What changed, and why it matters
This change makes the Monero wallet save ring-signature data to its local database before sending a transaction to the network. If the first broadcast fails and the wallet later rebuilds the transaction, it can reuse the same ring members instead of accidentally picking a new set. Reusing rings helps preserve privacy by avoiding two different-looking transactions that could be linked together.
Treat as a low-risk privacy-hardening fix. Review related PR #11392 and any linked issue for the exact failure scenario. Consider whether add_rings should be rolled back if the subsequent relay succeeds but the wallet later receives a conflicting/spent notification.
Security signals we found
Privacy-hardening change: prevents ring member divergence on transaction rebuild after failed relay
Adds defensive sanity checks before persisting rings
Catches exceptions and logs rather than aborting commit, preserving availability
No cryptographic or consensus-critical logic changed
Evidence from the diff
In wallet2::commit_tx(), the patch now calls add_rings(ptx.tx) before relaying the raw transaction, after sanity-checking the pending tx and verifying that all txin_to_key inputs have key_offsets sizes within the configured maximum ring size. The intent is to persist ring members so that a post-failure rebuild can call get_rings() and reuse identical rings, preventing ring-member divergence between a failed submission and a rebuilt transaction.
Changed components
src/wallet/wallet2.cppwallet2::commit_tx()ring persistence / get_rings / add_ringsInspect captured patch +18 / −0
### src/wallet/wallet2.cpp
@@ -7944,6 +7944,24 @@ void wallet2::commit_tx(pending_tx& ptx)
{
using namespace cryptonote;
+ // Record the rings before relaying so a rebuild after a failed submission can reuse them.
+ // The transaction may have been built elsewhere, so only record rings of this wallet's
+ // selected outputs with a usable size.
+ try
+ {
+ sanity_check_pending_tx(ptx, true, true, std::nullopt, false);
+ const uint64_t max_ring_size = get_max_ring_size();
+ const bool ring_sizes_ok = std::all_of(ptx.tx.vin.begin(), ptx.tx.vin.end(), [max_ring_size](const txin_v &in) {
+ return in.type() != typeid(txin_to_key) || !max_ring_size || boost::get<txin_to_key>(in).key_offsets.size() <= max_ring_size;
+ });
+ if (ring_sizes_ok)
+ add_rings(ptx.tx);
+ }
+ catch (const std::exception &e)
+ {
+ MINFO("Not recording rings before relay: " << e.what());
+ }
+
// Normal submit
COMMAND_RPC_SEND_RAW_TX::request req;
req.tx_as_hex = epee::string_tools::buff_to_hex_nodelimer(tx_to_blob(ptx.tx));Why this scored 40/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.