Skip to content

Miner service templates ignore the configured wallet unless --wallet is passed #5713

@william08190

Description

@william08190

Bug

The generated miner service templates set wallet-related environment variables, but miners/linux/rustchain_linux_miner.py only receives the wallet through the CLI --wallet argument.

That means service-launched miners can ignore the wallet the user entered during setup and fall back to LocalMiner._gen_wallet(), mining under a random generated wallet instead of the configured payout/miner ID.

Evidence in the current code

setup.sh systemd template currently sets:

Environment="WALLET_NAME=$WALLET_NAME"
ExecStart=$PYTHON -u $INSTALL_DIR/rustchain_linux_miner.py

setup.sh launchd template similarly sets WALLET_NAME in EnvironmentVariables but only passes the script path in ProgramArguments.

scripts/install.sh sets:

Environment="RUSTCHAIN_WALLET=${wallet}"
ExecStart=${py} -u ${INSTALL_DIR}/rustchain_linux_miner.py

and the launchd plist sets RUSTCHAIN_WALLET but does not pass --wallet.

However miners/linux/rustchain_linux_miner.py parses and uses only the CLI arg:

parser.add_argument("--wallet", help="Wallet address")
...
miner = LocalMiner(wallet=args.wallet, ...)

LocalMiner.__init__ falls back to _gen_wallet() when wallet is missing.

Impact

A user can complete setup with a known wallet/miner ID, install the service, and then have the background miner run under a different generated wallet. Rewards and balance checks would not line up with the wallet shown in setup output or the bounty/payout wallet the user registered.

Expected behavior

Generated systemd and launchd services should pass the configured wallet explicitly:

python -u rustchain_linux_miner.py --wallet "$WALLET_NAME"

or the equivalent for the installer-local ${wallet} variable.

Fix

I added the fix to PR #5711:

#5711

The PR now updates both setup.sh and scripts/install.sh systemd/launchd templates to pass --wallet explicitly, while keeping PYTHONUNBUFFERED=1 / -u for prompt log output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions