Add Dogecoin production support: sweep-all-doge and getblockhash method

1. Added getblockhash() method to DogecoinClient for late payment scanning
   - Fixes 'DogecoinClient' object has no attribute 'getblockhash' error
   - Required for crypto watcher to scan for missed payments

2. Added sweep-all-doge Makefile target for dust collection
   - Sweeps ALL spendable Dogecoin balance to cold storage
   - Uses sendtoaddress with subtractfeefromamount=true for complete sweep
   - Includes safety confirmations and balance checks
   - Perfect for cleaning up dust from hot wallet

Usage:
  COLD_WALLET_ADDRESS=DYourColdAddress make sweep-all-doge

Critical for production Dogecoin deployment and hot wallet management.
This commit is contained in:
Russell Ballestrini 2025-09-28 16:49:13 -04:00
parent 2a73a631bc
commit 3b27bb55ce

View file

@ -62,7 +62,8 @@ help:
@echo "WALLET MANAGEMENT:"
@echo " make sweep-check - Check hot wallet balances (dry run)"
@echo " make sweep - Sweep funds to cold storage"
@echo " make sweep-all - Sweep ALL wallet funds to cold storage (dust collection)"
@echo " make sweep-all - Sweep ALL Monero wallet funds to cold storage (dust collection)"
@echo " make sweep-all-doge - Sweep ALL Dogecoin wallet funds to cold storage (dust collection)"
@echo " make monero-transactions - View recent wallet transactions"
@echo ""
@echo "CLEANUP:"
@ -209,7 +210,7 @@ monero-transactions:
# Sweep ALL wallet funds to cold storage (dust collection)
sweep-all: venv config
@echo "=== SWEEPING ALL WALLET FUNDS TO COLD STORAGE ==="
@echo "=== SWEEPING ALL MONERO WALLET FUNDS TO COLD STORAGE ==="
@echo "CAUTION: This will send ALL unlocked balance from ALL accounts!"
@echo ""
@if [ -z "$${COLD_WALLET_ADDRESS}" ]; then \
@ -253,6 +254,55 @@ sweep-all: venv config
echo ""; \
echo "All account sweep operations completed!"
# Sweep ALL Dogecoin wallet funds to cold storage (dust collection)
sweep-all-doge: check-dogecoin
@echo "=== SWEEPING ALL DOGECOIN WALLET FUNDS TO COLD STORAGE ==="
@echo "CAUTION: This will send ALL unlocked balance from wallet!"
@echo ""
@if [ -z "$${COLD_WALLET_ADDRESS}" ]; then \
echo "ERROR: COLD_WALLET_ADDRESS environment variable not set!"; \
echo "Usage: COLD_WALLET_ADDRESS=<doge-address> make sweep-all-doge"; \
exit 1; \
fi
@echo "Checking wallet balance..."
@if ! dogecoin-cli getwalletinfo >/dev/null 2>&1; then \
echo "❌ Dogecoin wallet not accessible. Is dogecoind running?"; \
echo "Start with: make dogecoin-node"; \
exit 1; \
fi
@balance=$$(dogecoin-cli getbalance); \
unconfirmed=$$(dogecoin-cli getunconfirmedbalance || echo "0"); \
if [ "$$(echo "$$balance == 0" | bc -l)" = "1" ]; then \
echo "No spendable balance to sweep!"; \
echo "Balance: $$balance DOGE"; \
echo "Unconfirmed: $$unconfirmed DOGE"; \
exit 1; \
fi; \
echo "Spendable balance: $$balance DOGE"; \
echo "Unconfirmed: $$unconfirmed DOGE"; \
echo ""; \
echo "Target address: $${COLD_WALLET_ADDRESS}"; \
echo ""; \
read -p "Are you sure you want to sweep ALL spendable funds? (yes/no): " confirm; \
if [ "$$confirm" != "yes" ]; then \
echo "Cancelled."; \
exit 0; \
fi; \
echo ""; \
echo "Sweeping $$balance DOGE to cold storage..."; \
txid=$$(dogecoin-cli sendtoaddress "$${COLD_WALLET_ADDRESS}" $$balance "" "" true); \
if [ $$? -eq 0 ]; then \
echo "✓ Sweep successful!"; \
echo "Amount: $$balance DOGE"; \
echo "Transaction ID: $$txid"; \
echo ""; \
echo "New wallet balance:"; \
dogecoin-cli getbalance; \
else \
echo "❌ Sweep failed!"; \
exit 1; \
fi
# -----------------------------------------------------------------------------
# Monero Infrastructure Targets
# -----------------------------------------------------------------------------