Skip to content

jmwallet.cli.debug_info

jmwallet.cli.debug_info

Privacy-friendly diagnostic information for support and troubleshooting.

Outputs system, backend, and package version details without exposing any wallet keys, addresses, balances, or transaction data.

Attributes

Functions

debug_info(network: Annotated[str | None, typer.Option('--network', '-n', help='Bitcoin network')] = None, backend_type: Annotated[str | None, typer.Option('--backend', '-b', help='Backend: scantxoutset | descriptor_wallet | neutrino')] = None, neutrino_url: Annotated[str | None, typer.Option('--neutrino-url', envvar='NEUTRINO_URL')] = None, log_level: Annotated[str | None, typer.Option('--log-level', '-l', help='Log level')] = None) -> None

Print privacy-friendly diagnostic information for troubleshooting.

Outputs system details, package versions, and backend status. No wallet keys, addresses, balances, or transaction data is included.

Source code in jmwallet/src/jmwallet/cli/debug_info.py
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
@app.command("debug-info")
def debug_info(
    network: Annotated[
        str | None,
        typer.Option("--network", "-n", help="Bitcoin network"),
    ] = None,
    backend_type: Annotated[
        str | None,
        typer.Option(
            "--backend", "-b", help="Backend: scantxoutset | descriptor_wallet | neutrino"
        ),
    ] = None,
    neutrino_url: Annotated[
        str | None,
        typer.Option("--neutrino-url", envvar="NEUTRINO_URL"),
    ] = None,
    log_level: Annotated[
        str | None,
        typer.Option("--log-level", "-l", help="Log level"),
    ] = None,
) -> None:
    """Print privacy-friendly diagnostic information for troubleshooting.

    Outputs system details, package versions, and backend status.
    No wallet keys, addresses, balances, or transaction data is included.
    """
    settings = setup_cli(log_level)

    backend = resolve_backend_settings(
        settings,
        network=network,
        backend_type=backend_type,
        neutrino_url=neutrino_url,
    )

    sections: list[str] = []

    # -- JoinMarket NG -------------------------------------------------
    lines = [
        "JoinMarket NG",
        f"  version:    {get_version()}",
    ]
    commit_hash = get_commit_hash()
    if commit_hash:
        lines.append(f"  commit:     {commit_hash}")
    lines.append(f"  deployment: {_detect_deployment()}")
    pkg_versions = _get_package_versions()
    if pkg_versions:
        lines.append("  packages:")
        for pkg, ver in pkg_versions.items():
            lines.append(f"    {pkg}: {ver}")
    sections.append("\n".join(lines))

    # -- System --------------------------------------------------------
    sys_info = _get_system_info()
    lines = ["System"]
    for key, value in sys_info.items():
        lines.append(f"  {key}: {value}")
    sections.append("\n".join(lines))

    # -- Backend -------------------------------------------------------
    lines = [
        "Backend",
        f"  type:    {backend.backend_type}",
        f"  network: {backend.network}",
    ]
    if backend.backend_type == "neutrino":
        lines.append(f"  url:     {backend.neutrino_url}")
        lines.append(f"  tls:     {'enabled' if backend.neutrino_tls_cert else 'disabled'}")
        lines.append(f"  auth:    {'enabled' if backend.neutrino_auth_token else 'disabled'}")
    else:
        lines.append(f"  rpc_url: {backend.rpc_url}")
    sections.append("\n".join(lines))

    # -- Neutrino details (async probe) --------------------------------
    if backend.backend_type == "neutrino":
        try:
            neutrino_info = asyncio.run(
                _get_neutrino_info(
                    backend.neutrino_url,
                    tls_cert_path=backend.neutrino_tls_cert,
                    auth_token=backend.neutrino_auth_token,
                )
            )
            lines = ["Neutrino Server"]
            for key, value in neutrino_info.items():
                if key == "url":
                    continue  # Already shown in Backend section
                lines.append(f"  {key}: {value}")
            sections.append("\n".join(lines))
        except Exception as exc:
            logger.debug(f"Neutrino probe failed: {exc}")
            sections.append("Neutrino Server\n  status: probe failed")

    typer.echo("\n\n".join(sections))