[Infra] Auto-Sweep to Cold Storage #51
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & Why
Add an automatic sweep script to the node infrastructure that monitors the LND on-chain wallet balance and sends any excess above a configurable threshold to a user-provided cold Bitcoin address. Every sweep also triggers a channel state backup.
Done looks like
infrastructure/sweep.shexists and can be run manually or by cronsweep.confholds: cold address, keep threshold (default 300 K sats), minimum sweep floor (default 50 K sats)infrastructure/lnd-init.shprompts for a cold address during node setup and writes it intosweep.confinfrastructure/setup.shinstalls two cron jobs: daily sweep at 3am, daily backup at 4aminfrastructure/ops.shgains asweepcommand showing current config, wallet balance, and last sweep log/var/log/timmy-sweep.logwith timestamp, amount, txidsweep.shexits cleanly with a warningOut of scope
Tasks
sweep.conf, query LND on-chain balance vialncli walletbalance, calculate sweep amount, send vialncli sendcoins, log txid. Triggerops.sh backupafter successful sweep.lnd-init.shto prompt for cold address + writesweep.conf. Updatesetup.shto install both cron jobs and copysweep.shto/opt/timmy-node/.bash ops.sh sweep: show config (address, thresholds), current on-chain balance, last 5 lines of sweep log.Relevant files
infrastructure/setup.shinfrastructure/lnd-init.shinfrastructure/ops.shPR #76 created. All issue requirements were already implemented in the codebase (sweep.sh with static/xpub/list modes, lnd-init.sh cold address prompt, setup.sh cron jobs, ops.sh sweep command). This PR adds a
sweep.conf.exampletemplate for documentation, copies it during setup, and removes a redundant state file reload in sweep.sh.