igneum/proto-cuda/windows-app/start-node.ps1
igneum-labs faaea2fa74 Windows app: node and miners in one window, NODE card on the dashboard
proto-cuda/windows-app/: START-IGNEUM.bat starts igneumd, waits for sync, then runs the
miners; igneum-common.ps1 holds the dashboard, node, chain reader and miner functions once,
dot-sourced by start-igneum.ps1, start-mining.ps1 and start-node.ps1. STOP-IGNEUM.bat stops
everything in order. make-package.sh builds igneum-windows.zip.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-03 21:19:22 +00:00

66 lines
3.7 KiB
PowerShell

# Igneum devnet node, Windows launcher: the node only. Started by START-NODE.bat, which sets the settings as environment
# variables (MAC_NODE, RPC_LISTEN, P2P_LISTEN, APPDIR, UNSYNCED_MINING, EXTRA_ARGS, PLAIN). 3 October 2026.
# The functions live in igneum-common.ps1; START-IGNEUM.bat runs the same code with the miners in the same window.
#
# Starts igneumd.exe --devnet with --appdir, --rpclisten, --listen, --addpeer=<Mac>, --nodnsseed, --disable-upnp and
# --nologfiles (the node's output goes to node-<stamp>.log, a new segment per start). The window shows the NODE card
# (a reading every 5 s while syncing, then every 30 s), a status line goes to the launcher log every 30 s, the logs are
# uploaded every 60 s, a crash restarts the node after 5 to 60 s, Ctrl+C stops it.
#
# Why --addpeer and not --connect: in igneumd (kaspad/src/daemon.rs) --connect sets the inbound limit to 0 and skips
# outbound peers, so the Mac could never dial this PC. --addpeer keeps the Mac as a permanent peer (retried with a
# backoff of up to 8 minutes, components/connectionmanager/src/lib.rs) and leaves the listener open for the Mac.
$launcherName = 'node-launcher'
. (Join-Path $PSScriptRoot 'igneum-common.ps1')
$script:title = 'Igneum devnet node'
Set-NodeTarget $rpcHost $rpcPort
Log "igneum node launcher on $machine (run $stamp): Mac node $macNode, RPC $rpcListen, p2p $p2pListen, appdir $appDir, unsynced mining $(if ($unsyncedMining) { 'on' } else { 'off' })"
if (-not (Test-Path $nodeExe)) { Log 'igneumd.exe is missing from this folder. Extract the whole zip first.'; exit 1 }
$ver = ''
try { $ver = (& $nodeExe --version 2>&1 | Select-Object -First 1) } catch { $ver = "could not run igneumd.exe: $_" }
Log "node binary: $nodeExe ($ver)"
if (-not (Test-Path $miner)) { Log 'igneum-miner.exe is not in this folder: the card will only say whether the node process is alive' }
$ports = Test-NodePorts
if ($ports -eq 'external') { Log "a node already answers on ${rpcHost}:${rpcPort}. Is another START-NODE or START-IGNEUM window open? Close it first."; exit 1 }
if ($ports -ne 'free') { Log $ports; exit 1 }
if (Test-TcpPort $macHost ([int]$macPort) 1500) { Log "the Mac node answers on $macNode" } else { Log "the Mac node at $macNode does not answer right now; igneumd will keep retrying (backoff up to 8 minutes)" }
Log "If Windows Firewall asks about igneumd.exe: tick Private networks and click Allow access (the Mac node dials this PC on port $p2pPort). If you clicked Cancel once, run ALLOW-FIREWALL.bat."
New-Item -ItemType Directory -Force -Path $appDir | Out-Null
$script:node.on = $true
$script:node.managed = $true
Start-Node
Start-Sleep -Seconds 3
if ($script:node.proc.HasExited) {
Log "igneumd exited at once with code $($script:node.proc.ExitCode). Last lines:"
foreach ($l in (Get-TailLines $script:node.err 8)) { Log " stderr: $l" }
foreach ($l in (Get-TailLines $script:node.log 8)) { Log " stdout: $l" }
Log "Nothing to restart. Fix the cause above (a wrong --appdir, a port in use, a database from an older build that needs deleting: $appDir) and start again."
exit 1
}
foreach ($l in (Get-TailLines $script:node.log 3)) { Log " node: $l" }
Enable-KeepAwake 'the node runs'
[Console]::TreatControlCAsInput = $true
Log "running. Press Ctrl+C to stop. The node's full output is in $($script:node.log)"
Start-ChainSample
Start-Dashboard
$stop = $false
$exitCode = 0
try {
while (-not $stop) {
Start-Sleep -Milliseconds 500
if (Test-StopKey) { $stop = $true; break }
Invoke-CommonStep
if ($script:node.gaveUp) { break }
}
} finally {
if ($script:node.gaveUp) { $exitCode = 1 }
Stop-Everything $(if ($stop) { 'Ctrl+C: stopping' } else { '' })
}
exit $exitCode