mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 07:21:32 +02:00
feat(wallet): subaddress provisioning and batched UTXO endpoints (off by default)
Backend support for two address-privacy features. Both are behind env flags
that default to off, so an unconfigured instance behaves exactly as before:
the routes are not mounted and no provisioning is attempted.
FEATURE_XMR_SUBADDR_PROVISIONING
Adds POST /wallet/lws/provision_subaddrs and provisions account-0 subaddress
indices on the LWS at register/import.
Three money-safety properties worth calling out:
* The provisioned ceiling is read from the LWS response, never echoed back
from the request. It is the contiguous run starting at minor 0, not
max(hi): given ranges [[0,99],[200,299]], reporting 299 would let a wallet
hand out indices 100..199 that the LWS never scans, so funds sent there
would be invisible. No usable run is a hard error, not a guess.
* import_account now always runs the backward rescan even when provisioning
fails. Previously a provisioning error aborted first, leaving the account
registered at the chain tip while every retry returned 200 OK, so a
restoring wallet would show a zero balance permanently.
* A capacity probe reads max_subaddresses from the LWS and refuses up front
with a message naming the required --max-subaddresses value, rather than
failing per-account later. The option defaults to 0 upstream.
Spent outputs now carry their subaddress index. monero-lws emits this as
`sender` (the index the spent output was received at), not `recipient`;
without it a client recomputes a primary key image for a subaddress spend,
treats the mismatch as a decoy, and never subtracts the amount.
FEATURE_UTXO_MULTI_ADDRESS
Adds balance_multi / utxos_multi / history_multi for HD gap-limit wallets.
Capped at 32 addresses, summed with checked_add, per-UTXO address tag
preserved so the client never has to re-guess which key owns an output.
Bounded concurrency with a per-batch deadline returning 504, so a slow
Electrum server cannot stack n * IO_TIMEOUT.
Both flags are advertised in /capabilities so a client can negotiate instead
of calling routes that 404.
This commit is contained in:
@@ -42,10 +42,14 @@ use utoipa::OpenApi;
|
||||
crate::api::wallet::btc_ltc::balance,
|
||||
crate::api::wallet::btc_ltc::utxos,
|
||||
crate::api::wallet::btc_ltc::history,
|
||||
crate::api::wallet::btc_ltc::balance_multi,
|
||||
crate::api::wallet::btc_ltc::utxos_multi,
|
||||
crate::api::wallet::btc_ltc::history_multi,
|
||||
crate::api::wallet::btc_ltc::tip,
|
||||
crate::api::wallet::btc_ltc::fee,
|
||||
crate::api::wallet::btc_ltc::broadcast,
|
||||
crate::api::wallet::xmr_wow::register,
|
||||
crate::api::wallet::xmr_wow::provision_subaddrs,
|
||||
crate::api::wallet::xmr_wow::balance,
|
||||
crate::api::wallet::xmr_wow::history,
|
||||
crate::api::wallet::xmr_wow::unspent_outs,
|
||||
@@ -125,6 +129,12 @@ use utoipa::OpenApi;
|
||||
crate::api::wallet::btc_ltc::UtxosResponse,
|
||||
crate::api::wallet::btc_ltc::HistoryEntry,
|
||||
crate::api::wallet::btc_ltc::HistoryResponse,
|
||||
crate::api::wallet::btc_ltc::MultiAddressRequest,
|
||||
crate::api::wallet::btc_ltc::MultiBalanceResponse,
|
||||
crate::api::wallet::btc_ltc::TaggedUtxo,
|
||||
crate::api::wallet::btc_ltc::MultiUtxosResponse,
|
||||
crate::api::wallet::btc_ltc::TaggedHistoryEntry,
|
||||
crate::api::wallet::btc_ltc::MultiHistoryResponse,
|
||||
crate::api::wallet::btc_ltc::AssetRequest,
|
||||
crate::api::wallet::btc_ltc::TipResponse,
|
||||
crate::api::wallet::btc_ltc::FeeRequest,
|
||||
@@ -133,11 +143,14 @@ use utoipa::OpenApi;
|
||||
crate::api::wallet::btc_ltc::BroadcastResponse,
|
||||
crate::api::wallet::xmr_wow::ViewRequest,
|
||||
crate::api::wallet::xmr_wow::RegisterRequest,
|
||||
crate::api::wallet::xmr_wow::ProvisionRequest,
|
||||
crate::api::wallet::xmr_wow::ProvisionResponse,
|
||||
crate::api::wallet::xmr_wow::RandomOutsRequest,
|
||||
crate::api::wallet::xmr_wow::SubmitRequest,
|
||||
crate::api::wallet::xmr_wow::LwsAssetRequest,
|
||||
crate::api::wallet::xmr_wow::ConfirmationsRequest,
|
||||
crate::api::wallet::xmr_wow::LwsBalanceResponse,
|
||||
crate::api::wallet::xmr_wow::SubaddrIndexDto,
|
||||
crate::api::wallet::xmr_wow::SpentOutputDto,
|
||||
crate::api::wallet::xmr_wow::TxDto,
|
||||
crate::api::wallet::xmr_wow::LwsHistoryResponse,
|
||||
|
||||
Reference in New Issue
Block a user