dcrdex icon indicating copy to clipboard operation
dcrdex copied to clipboard

dcr: spv will panic on retry in spv loop.

Open JoeGruffins opened this issue 8 months ago • 1 comments
trafficstars

Here: https://github.com/decred/dcrdex/blob/1ecfbc03e2c5d1359b5d51b32650e6cbff29b6b0/client/asset/dcr/spv.go#L430-L443

This was recently found while developing libwallet for cake, if the error has nothing to do with the context, this will panic on the second try of syncer.Run with closing a closed channel when close(s.initialSyncDone) happens for a second time. Unsure if intended on the dcrwallet side but doesn't seem to come up much anyway. The fix for libwallet is to recreate the syncer on every try. https://github.com/decred/libwallet/pull/18

JoeGruffins avatar Mar 12 '25 06:03 JoeGruffins

Wow, actually hit this today on mainnet. Maybe it's due to some recent change:

2025-03-18 02:04:43.594 [INF] CORE: notify: |SUCCESS| (walletconfig) Wallet connectivity restored - Decred wallet has reestablished connectivity.
panic: close of closed channel

goroutine 19964016 [running]:
decred.org/dcrwallet/v4/spv.(*Syncer).Run.func12()
        /home/joe/go/pkg/mod/decred.org/dcrwallet/[email protected]/spv/sync.go:453 +0x2f8
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /home/joe/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x54
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 289
        /home/joe/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x98

JoeGruffins avatar Mar 19 '25 02:03 JoeGruffins