What changed, and why it matters
This commit refactors how the Monero wallet fetches a transaction when verifying a payment proof (the check_tx_key feature). It replaces a direct daemon RPC call with a helper function called get_tx_for_proof, which is described in the commit title as adding verification for older v1 transaction IDs. The change appears intended to prevent a wallet from being tricked by a fake or mismatched transaction when checking a proof, but the diff itself only shows the refactoring, not the new helper's implementation.
Review the implementation of get_tx_for_proof in the same pull request/merge commit to confirm it properly validates v1 transaction IDs and preserves the txid-to-transaction integrity check. Users should upgrade once the release containing this fix is available, especially if they rely on check_tx_key with older transaction proofs.
Security signals we found
Replaces direct /gettransactions RPC with centralized helper for proof verification
Commit title explicitly frames change as 'verify v1 txid in check_tx_key'
Removes local tx_hash == txid equality check in favor of helper-internal verification
Touches payment-proof verification code path (check_tx_key)
Evidence from the diff
The patch modifies wallet2::check_tx_key_helper in src/wallet/wallet2.cpp. It removes inline code that called /gettransactions, parsed the pruned transaction, and checked tx_hash == txid. Instead it calls get_tx_for_proof(txid, tx) and uses the returned tx_entry for in_pool, block_height, and confirmations. The commit title says ‘wallet: verify v1 txid in check_tx_key’, implying get_tx_for_proof adds validation for legacy v1 transaction ID formats. Without the helper’s diff we cannot see the actual verification logic; the visible change is a cleanup that centralizes transaction retrieval for proof verification.
Changed components
src/wallet/wallet2.cppwallet2::check_tx_key_helperMonero payment proof verification (check_tx_key)Inspect captured patch +5 / −24
### src/wallet/wallet2.cpp
@@ -12755,46 +12755,27 @@ void wallet2::check_tx_key_helper(const crypto::hash &txid, const crypto::key_de
uint32_t rpc_version;
THROW_WALLET_EXCEPTION_IF(!check_connection(&rpc_version), error::wallet_internal_error, "Failed to connect to daemon: " + get_daemon_address());
- COMMAND_RPC_GET_TRANSACTIONS::request req;
- COMMAND_RPC_GET_TRANSACTIONS::response res;
- req.txs_hashes.push_back(epee::string_tools::pod_to_hex(txid));
- req.decode_as_json = false;
- req.prune = true;
-
- bool ok;
- {
- const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
- ok = epee::net_utils::invoke_http_json("/gettransactions", req, res, *m_http_client);
- THROW_WALLET_EXCEPTION_IF(!ok || res.txs.size() != 1,
- error::wallet_internal_error, "Failed to get transaction from daemon");
- }
-
cryptonote::transaction tx;
- crypto::hash tx_hash;
- ok = get_pruned_tx(res.txs.front(), tx, tx_hash);
- THROW_WALLET_EXCEPTION_IF(!ok, error::wallet_internal_error, "Failed to parse transaction from daemon");
-
- THROW_WALLET_EXCEPTION_IF(tx_hash != txid, error::wallet_internal_error,
- "Failed to get the right transaction from daemon");
+ const auto tx_entry = get_tx_for_proof(txid, tx);
THROW_WALLET_EXCEPTION_IF(additional_derivations.size() > tx.vout.size(), error::wallet_internal_error,
"The size of additional derivations is wrong");
check_tx_key_helper(tx, derivation, additional_derivations, address, received);
- in_pool = res.txs.front().in_pool;
+ in_pool = tx_entry.in_pool;
confirmations = 0;
if (!in_pool)
{
if (rpc_version < MAKE_CORE_RPC_VERSION(3, 7))
{
std::string err;
uint64_t bc_height = get_daemon_blockchain_height(err);
- if (err.empty() && bc_height > res.txs.front().block_height)
- confirmations = bc_height - res.txs.front().block_height;
+ if (err.empty() && bc_height > tx_entry.block_height)
+ confirmations = bc_height - tx_entry.block_height;
}
else
{
- confirmations = res.txs.front().confirmations;
+ confirmations = tx_entry.confirmations;
}
}
}Why this scored 37/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.