mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 07:21:32 +02:00
feat(restore): operator-configurable wallet restore policy
How far back a wallet may ask THIS instance to scan on import is an operator decision — the backfill cost lands on its LWS/node. Add WALLET_RESTORE_POLICY (create-only | bounded | unlimited, default bounded) + WALLET_MAX_RESTORE_DEPTH_DAYS, advertise it via /capabilities so the wallet adapts its import UX, and enforce it at the scan path (xmr/wow register, grin scan): a too-deep start_height is a ValidationError naming the bound, never the caller's value. Create needs no check (no tip lookup). Self-sovereignty stays intact at the ecosystem level — a deeper restore means self-hosting or a looser operator. Fail-closed config validation; a unit test per policy; OpenAPI drift clean.
This commit is contained in:
+27
-1
@@ -1891,7 +1891,8 @@
|
||||
"version",
|
||||
"contract_version",
|
||||
"chains",
|
||||
"features"
|
||||
"features",
|
||||
"restore"
|
||||
],
|
||||
"properties": {
|
||||
"chains": {
|
||||
@@ -1906,6 +1907,10 @@
|
||||
"features": {
|
||||
"$ref": "#/components/schemas/FeatureCapabilities"
|
||||
},
|
||||
"restore": {
|
||||
"$ref": "#/components/schemas/RestoreCapability",
|
||||
"description": "Wallet restore (import) policy for this instance."
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "Backend version (Cargo package version)."
|
||||
@@ -2972,6 +2977,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"RestoreCapability": {
|
||||
"type": "object",
|
||||
"description": "This instance's wallet-restore (import) policy. The wallet uses it to adapt\nits import UX — hide/grey the restore-height field under `create-only`, warn\nwhen a chosen date exceeds the bound. `max_depth_days` is present only for\nthe `bounded` policy.",
|
||||
"required": [
|
||||
"policy"
|
||||
],
|
||||
"properties": {
|
||||
"max_depth_days": {
|
||||
"type": [
|
||||
"integer",
|
||||
"null"
|
||||
],
|
||||
"format": "int32",
|
||||
"minimum": 0
|
||||
},
|
||||
"policy": {
|
||||
"type": "string",
|
||||
"description": "`create-only` | `bounded` | `unlimited`."
|
||||
}
|
||||
}
|
||||
},
|
||||
"SetUsernameRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user