jmwalletd.routers.tumbler
jmwalletd.routers.tumbler
Tumbler endpoints backed by :mod:tumbler.
The router exposes a small, stateless-ish HTTP surface over the persistent
YAML plan managed by :mod:tumbler.persistence and the in-memory runner
owned by :class:jmwalletd.state.DaemonState:
POST /tumbler/plan-- build a new plan and persist it asPENDING.POST /tumbler/start-- run the pending plan; the runner updates the plan in place and the daemon keeps a handle on the task.GET /tumbler/status-- fetch the current plan (in-memory if running, otherwise from disk). Flags astaleplan whose on-disk status isRUNNINGbut no runner is live (crash recovery marker).POST /tumbler/stop-- cooperatively request the runner to stop; the task transitions the plan toCANCELLEDand tears down its taker / maker.DELETE /tumbler/plan-- remove a terminal or pending plan. Refuses when the runner is live -- stop first.
See docs/technical/tumbler-redesign.md for the state matrix and
subset-sum rationale. The router itself is intentionally thin so all plan
semantics stay in :mod:tumbler.
Attributes
_ = BackendNotReady
module-attribute
router = APIRouter()
module-attribute
Classes
Functions:
build_tumbler_taker_config(*, phase: Any, mnemonic: Any, jm_settings: Any, taker_config_cls: Any) -> Any
Build a TakerConfig for a tumbler taker phase.
Delegates to :func:taker.config_builder.build_taker_config_kwargs (the
same mapping the CLI taker and standalone tumbler use) so daemon-run
tumbler phases honor every [taker] policy setting. This factory used
to set only the network/Tor/directory fields, so fee limits, timeouts,
and the orderbook-wait knobs silently fell back to TakerConfig
defaults for tumbles started through the API.
minimum_makers is capped at the phase's counterparty_count so a
sweep that legitimately selects N makers is not rejected against a
higher policy threshold (default 4), which failed phases with
Not enough makers for sweep: N.
destination is resolved inside the runner (INTERNAL sentinel), so an
empty placeholder is passed here; the Taker reads it only when
do_coinjoin is not given one.
Source code in jmwalletd/src/jmwalletd/routers/tumbler.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
create_plan(walletname: str, body: TumblerPlanRequest, _auth: dict[str, Any] = Depends(require_auth), _wallet: None = Depends(require_wallet_match), state: DaemonState = Depends(get_daemon_state)) -> TumblerPlanResponse
async
Build and persist a fresh tumble plan for the active wallet.
An already-running plan for the wallet is always protected: callers must
POST /tumbler/stop first. A plan in any other state (pending,
completed, failed, cancelled) is overwritten unconditionally -- passing
force=true is only required for a pending plan, to make the
destructive intent explicit.
Source code in jmwalletd/src/jmwalletd/routers/tumbler.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
delete_plan_endpoint(walletname: str, _auth: dict[str, Any] = Depends(require_auth), _wallet: None = Depends(require_wallet_match), state: DaemonState = Depends(get_daemon_state)) -> JSONResponse
async
Remove a non-running plan from disk.
Source code in jmwalletd/src/jmwalletd/routers/tumbler.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | |
get_status(walletname: str, _auth: dict[str, Any] = Depends(require_auth), _wallet: None = Depends(require_wallet_match), state: DaemonState = Depends(get_daemon_state)) -> TumblerPlanResponse
async
Return the live plan if the runner is active, otherwise the on-disk plan.
When the on-disk plan is RUNNING but no runner is live, the response's
stale flag is set so the UI can prompt the user to acknowledge the
failure and delete the plan.
Source code in jmwalletd/src/jmwalletd/routers/tumbler.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
start_plan(walletname: str, _auth: dict[str, Any] = Depends(require_auth), _wallet: None = Depends(require_wallet_match), state: DaemonState = Depends(get_daemon_state)) -> JSONResponse
async
Load the pending plan and run it in the background.
Source code in jmwalletd/src/jmwalletd/routers/tumbler.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
stop_plan(walletname: str, _auth: dict[str, Any] = Depends(require_auth), _wallet: None = Depends(require_wallet_match), state: DaemonState = Depends(get_daemon_state)) -> JSONResponse
async
Cooperatively stop the running plan; transition it to CANCELLED.
Source code in jmwalletd/src/jmwalletd/routers/tumbler.py
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | |