From 5e54c72629ccf3841d95a1b549c953e48909f09b Mon Sep 17 00:00:00 2001 From: jeffro256 Date: Thu, 24 Jul 2025 00:36:07 -0500 Subject: [PATCH] wallet: RPC method /incoming_transfers without daemon connection Allows calling /incoming_transfers for cold wallets especially --- src/wallet/wallet_rpc_server.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index c1d4b1476..e42d2294f 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -2202,6 +2202,11 @@ namespace tools { if (req.account_index != td.m_subaddr_index.major || (!req.subaddr_indices.empty() && req.subaddr_indices.count(td.m_subaddr_index.minor) == 0)) continue; + + // wallet2::is_transfer_unlocked() needs a daemon connection to work. if it fails, assume locked + bool unlocked = false; + try { unlocked = m_wallet->is_transfer_unlocked(td); } catch (...) {} + wallet_rpc::transfer_details rpc_transfers; rpc_transfers.amount = td.amount(); rpc_transfers.spent = td.m_spent; @@ -2212,7 +2217,7 @@ namespace tools rpc_transfers.pubkey = epee::string_tools::pod_to_hex(td.get_public_key()); rpc_transfers.block_height = td.m_block_height; rpc_transfers.frozen = td.m_frozen; - rpc_transfers.unlocked = m_wallet->is_transfer_unlocked(td); + rpc_transfers.unlocked = unlocked; res.transfers.push_back(rpc_transfers); } }