1
0
Fork 0
forked from lthn/blockchain

added force_rescan_tx_pool command to wallet rpc

This commit is contained in:
cryptozoidberg 2025-05-05 21:32:50 +04:00
parent cc7188f450
commit ef0a47c720
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
4 changed files with 33 additions and 1 deletions

View file

@ -69,7 +69,7 @@ struct core_critical_error_handler_t : public currency::i_critical_error_handler
LOG_ERROR(ENDL << ENDL << "Serious TIME sync problem detected, daemon will stop immediately" << ENDL << ENDL);
// stop handling
dch.stop_handling();
p2psrv.send_stop_signal();
return true; // the caller must stop processing
}

View file

@ -751,6 +751,26 @@ namespace wallet_public
};
};
struct COMMAND_RPC_FORCE_RESCAN_TX_POOL
{
DOC_COMMAND("Force wallet to fetch tx pool from daemon and go through it's transactions");
struct request
{
BEGIN_KV_SERIALIZE_MAP()
END_KV_SERIALIZE_MAP()
};
struct response
{
std::string status;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status) DOC_DSCR("Operation status") DOC_EXMP(API_RETURN_CODE_OK) DOC_END
END_KV_SERIALIZE_MAP()
};
};
struct payment_details
{
std::string payment_id;

View file

@ -572,6 +572,16 @@ namespace tools
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::force_rescan_tx_pool(const wallet_public::COMMAND_RPC_FORCE_RESCAN_TX_POOL::request& req, wallet_public::COMMAND_RPC_FORCE_RESCAN_TX_POOL::response& res, epee::json_rpc::error& er, connection_context& cntx)
{
WALLET_RPC_BEGIN_TRY_ENTRY();
bool dummy = false;
w.get_wallet()->scan_tx_pool(dummy);
res.status = API_RETURN_CODE_OK;
WALLET_RPC_CATCH_TRY_ENTRY();
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_get_payments(const wallet_public::COMMAND_RPC_GET_PAYMENTS::request& req, wallet_public::COMMAND_RPC_GET_PAYMENTS::response& res, epee::json_rpc::error& er, connection_context& cntx)
{
WALLET_RPC_BEGIN_TRY_ENTRY();

View file

@ -114,6 +114,7 @@ namespace tools
MAP_JON_RPC_WE("get_recent_txs_and_info2", on_get_recent_txs_and_info2, wallet_public::COMMAND_RPC_GET_RECENT_TXS_AND_INFO2)
MAP_JON_RPC_WE("transfer", on_transfer, wallet_public::COMMAND_RPC_TRANSFER)
MAP_JON_RPC_WE("store", on_store, wallet_public::COMMAND_RPC_STORE)
MAP_JON_RPC_WE("force_rescan_tx_pool", force_rescan_tx_pool, wallet_public::COMMAND_RPC_FORCE_RESCAN_TX_POOL)
MAP_JON_RPC_WE("get_payments", on_get_payments, wallet_public::COMMAND_RPC_GET_PAYMENTS)
MAP_JON_RPC_WE("get_bulk_payments", on_get_bulk_payments, wallet_public::COMMAND_RPC_GET_BULK_PAYMENTS)
MAP_JON_RPC_WE("make_integrated_address", on_make_integrated_address, wallet_public::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS)
@ -192,6 +193,7 @@ namespace tools
bool on_get_recent_txs_and_info2(const wallet_public::COMMAND_RPC_GET_RECENT_TXS_AND_INFO2::request& req, wallet_public::COMMAND_RPC_GET_RECENT_TXS_AND_INFO2::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_transfer(const wallet_public::COMMAND_RPC_TRANSFER::request& req, wallet_public::COMMAND_RPC_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_store(const wallet_public::COMMAND_RPC_STORE::request& req, wallet_public::COMMAND_RPC_STORE::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool force_rescan_tx_pool(const wallet_public::COMMAND_RPC_FORCE_RESCAN_TX_POOL::request& req, wallet_public::COMMAND_RPC_FORCE_RESCAN_TX_POOL::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_get_payments(const wallet_public::COMMAND_RPC_GET_PAYMENTS::request& req, wallet_public::COMMAND_RPC_GET_PAYMENTS::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_get_bulk_payments(const wallet_public::COMMAND_RPC_GET_BULK_PAYMENTS::request& req, wallet_public::COMMAND_RPC_GET_BULK_PAYMENTS::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_make_integrated_address(const wallet_public::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::request& req, wallet_public::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::response& res, epee::json_rpc::error& er, connection_context& cntx);