AthanorLabs / atomic-swap

💫 ETH-XMR atomic swap implementation
GNU Lesser General Public License v3.0
344 stars 44 forks source link

swapd panics on startup if RPC server port is in use #407

Closed noot closed 1 year ago

noot commented 1 year ago

as title says, if the RPC port is in use the node panics on startup. it should not panic but fail with a nice "port in use, pick another port with --rpc-port" message.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1313f11]

goroutine 1 [running]:
github.com/athanorlabs/atomic-swap/rpc.(*Server).Start(0x0)
        /go/pkg/mod/github.com/athanorlabs/atomic-swap@v0.1.1/rpc/server.go:169 +0x31
github.com/athanorlabs/atomic-swap/daemon.RunSwapDaemon({0x1c26bf8, 0xc0000c5720}, 0xc0000c4a50)
        /go/pkg/mod/github.com/athanorlabs/atomic-swap@v0.1.1/daemon/swap_daemon.go:162 +0xca7
main.runDaemon(0xc0001e00c0)
        /go/pkg/mod/github.com/athanorlabs/atomic-swap@v0.1.1/cmd/swapd/main.go:287 +0x3a8
github.com/urfave/cli/v2.(*Command).Run(0xc0000e58c0, 0xc0001e00c0, {0xc0000402c0, 0x1, 0x1})
        /go/pkg/mod/github.com/urfave/cli/v2@v2.25.1/command.go:274 +0x9eb
github.com/urfave/cli/v2.(*App).RunContext(0xc0000225a0, {0x1c26bf8?, 0xc0000c5720}, {0xc0000402c0, 0x1, 0x1})
        /go/pkg/mod/github.com/urfave/cli/v2@v2.25.1/app.go:332 +0x616
main.main()
        /go/pkg/mod/github.com/athanorlabs/atomic-swap@v0.1.1/cmd/swapd/main.go:231 +0x117