Files
proxmox/scripts/fix-block-production-on-host.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

89 lines
2.9 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Run ON a Proxmox host (no SSH). Fixes validator config (tx-pool layered + min-score=0)
# and restarts besu-validator for given VMIDs.
#
# Usage on r630-01 (192.168.11.11):
# bash fix-block-production-on-host.sh 1000 1001 1002
# Usage on ml110 (192.168.11.10):
# bash fix-block-production-on-host.sh 1003 1004
#
# Or from repo (pipe over SSH):
# ssh root@192.168.11.11 'bash -s' 1000 1001 1002 < scripts/fix-block-production-on-host.sh
# ssh root@192.168.11.10 'bash -s' 1003 1004 < scripts/fix-block-production-on-host.sh
#
# Requires: run as root on Proxmox host with pct available.
set -euo pipefail
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_ok() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
log_err() { echo -e "${RED}[✗]${NC} $1"; }
VMIDS=("$@")
if [ ${#VMIDS[@]} -eq 0 ]; then
echo "Usage: $0 <vmid> [vmid ...]"
echo " e.g. on r630-01: $0 1000 1001 1002"
echo " e.g. on ml110: $0 1003 1004"
exit 1
fi
fix_one() {
local vmid="$1"
local status
status=$(pct status "$vmid" 2>/dev/null | awk '{print $2}' || echo "unknown")
if [[ "$status" != "running" ]]; then
log_warn "VMID $vmid not running (status: $status) — skip"
return 0
fi
log_info "VMID $vmid: updating config and restarting besu-validator"
pct exec "$vmid" -- bash -c '
set -e
CFG=/etc/besu/config-validator.toml
[ -f /config/config-validator.toml ] && CFG=/config/config-validator.toml
if [ ! -f "$CFG" ]; then echo "Config not found: $CFG"; exit 1; fi
sed -i "/^tx-pool-max-size=/d" "$CFG" 2>/dev/null || true
sed -i "/^tx-pool-limit-by-account-percentage=/d" "$CFG" 2>/dev/null || true
sed -i "/^tx-pool-retention-hours=/d" "$CFG" 2>/dev/null || true
if ! grep -q "tx-pool-max-future-by-sender" "$CFG"; then
echo "" >> "$CFG"
echo "# Layered Transaction Pool (Besu 23.10+)" >> "$CFG"
echo "tx-pool-max-future-by-sender=200" >> "$CFG"
echo "tx-pool-layer-max-capacity=12500000" >> "$CFG"
echo "tx-pool-max-prioritized=2000" >> "$CFG"
echo "tx-pool-price-bump=10" >> "$CFG"
fi
# Remove tx-pool-min-score if present (unsupported in some Besu builds)
sed -i "/^tx-pool-min-score=/d" "$CFG" 2>/dev/null || true
'
log_ok " Config updated"
if ! pct exec "$vmid" -- systemctl restart besu-validator 2>/dev/null; then
log_err " Restart failed (check: pct exec $vmid -- systemctl status besu-validator)"
return 1
fi
log_ok " besu-validator restarted"
return 0
}
FAILED=0
for vmid in "${VMIDS[@]}"; do
if ! fix_one "$vmid"; then
((FAILED++)) || true
fi
echo ""
done
if [ "$FAILED" -eq 0 ]; then
log_ok "Done. Wait 12 min then check: bash scripts/monitoring/monitor-blockchain-health.sh"
exit 0
else
log_err "$FAILED VMID(s) failed."
exit 1
fi