The watcher routine is started each time a new channel is established. This can be identified from the logs of Test_Integ_Role, where the watcher would returned twice for each session ID for the same channel.
Relates to
Expected behaviour
That channel watcher should be started only once.
Current behaviour
The channel watcher is started twice for each channel.
Reproducing the behaviour
cd session
go test -cover -p 1 -count=1 -tags=integration -v -run Test_Integ_Role
As highlighted in the picture, two instances of channel watcher can be identified.
Major (Breaks one or more features or specifications)
Frequency
Always
Additional information
This occurs because, each time a new channel is created by the go-perun SDK by invoking ProposeChannel or Accept call on channel proposal responder, the channel object is returned in two places:
As a return value in the corresponding call.
Passed to the OnNewChannel handler, that was registered when initializing the state channel client in go-perun SDK.
Solution to this bug would be that, after restoring the channels, the OnNewChannel handler should be unregistered by setting it to nil or a dummy handler. As it is convenient to process the channels that are received as return values (synchronously).
Description
The watcher routine is started each time a new channel is established. This can be identified from the logs of
Test_Integ_Role
, where the watcher would returned twice for each session ID for the same channel.Relates to
Expected behaviour
That channel watcher should be started only once.
Current behaviour
The channel watcher is started twice for each channel.
Reproducing the behaviour
cd session
Software version
3df8c4fc7258582890bde96a79bf7ab51946f701
Environment information
Expand to see output from `go env` command.
``` bash # Output of "go env" command GO111MODULE="" GOARCH="amd64" GOBIN="/mnt/data-work/go/bin" GOCACHE="/home/manoranjith/.cache/go-build" GOENV="/home/manoranjith/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/mnt/data-work/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/mnt/data-work/projects/perun/workspace/perun-node/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build111707423=/tmp/go-build -gno-record-gcc-switches" ```Severity
Major (Breaks one or more features or specifications)
Frequency
Always
Additional information
This occurs because, each time a new channel is created by the
go-perun
SDK by invokingProposeChannel
orAccept
call on channel proposal responder, the channel object is returned in two places:OnNewChannel
handler, that was registered when initializing the state channel client in go-perun SDK.Solution to this bug would be that, after restoring the channels, the
OnNewChannel
handler should be unregistered by setting it to nil or a dummy handler. As it is convenient to process the channels that are received as return values (synchronously).