Files
proxmox/scripts/clear-rpc-2201-txpool.sh
defiQUG b3a8fe4496
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
chore: sync all changes to Gitea
- Config, docs, scripts, and backup manifests
- Submodule refs unchanged (m = modified content in submodules)

Made-with: Cursor
2026-03-02 11:37:34 -08:00

48 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Clear transaction pool on Public RPC node (VMID 2201 — 192.168.11.221).
# Use when deploying via RPC_URL_138_PUBLIC and you get "Known transaction".
# Usage: ./scripts/clear-rpc-2201-txpool.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
PROXMOX_USER="${PROXMOX_USER:-root}"
# 2201 is on r630-02 per health/check-rpc-vms-health.sh, verify-backend-vms.sh
HOST="${PROXMOX_R630_02:-${PROXMOX_HOST_R630_02:-192.168.11.12}}"
VMID=2201
SSH_TARGET="${PROXMOX_USER}@${HOST}"
echo "=== Clear Public RPC (VMID 2201) transaction pool ==="
echo "Host: $HOST"
echo ""
if ! ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "$SSH_TARGET" "pct list 2>/dev/null | grep -q '2201'"; then
echo "VMID 2201 not found on $HOST. Abort." >&2
exit 1
fi
echo "Stopping besu-rpc..."
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "$SSH_TARGET" \
"pct exec $VMID -- systemctl stop besu-rpc 2>/dev/null || pct exec $VMID -- systemctl stop besu-rpc.service 2>/dev/null || true" 2>&1 | grep -v "Configuration file" || true
sleep 2
echo "Clearing tx pool database..."
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "$SSH_TARGET" \
"pct exec $VMID -- bash -c '
for d in /data/besu /var/lib/besu; do
[ -d \"\$d\" ] && find \"\$d\" -type d -name \"*pool*\" -exec rm -rf {} \; 2>/dev/null; find \"\$d\" -type f -name \"*transaction*\" -delete 2>/dev/null; find \"\$d\" -type f -name \"*txpool*\" -delete 2>/dev/null; true
done
'" 2>&1 | grep -v "Configuration file" || true
echo "Pool cleared."
echo "Starting besu-rpc..."
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "$SSH_TARGET" \
"pct exec $VMID -- systemctl start besu-rpc 2>/dev/null || pct exec $VMID -- systemctl start besu-rpc.service 2>/dev/null || true" 2>&1 | grep -v "Configuration file" || true
sleep 3
echo ""
echo "Done. Wait 30s then run: ./scripts/deployment/deploy-transaction-mirror-and-pmm-pool-after-txpool-clear.sh"