From f656ceb652c8a31d3534e15dfa97dcc1956fa3bd Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 3 May 2017 16:04:06 -0400 Subject: [PATCH] rpcserver: Always read wsclient filter with mutex held. --- rpcwebsocket.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rpcwebsocket.go b/rpcwebsocket.go index 8e5c82ec..4c06d54d 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -1751,16 +1751,17 @@ func handleLoadTxFilter(wsc *wsClient, icmd interface{}) (interface{}, error) { wsc.filterData = makeWSClientFilter(cmd.Addresses, outPoints) wsc.Unlock() } else { + filter := wsc.filterData wsc.Unlock() - wsc.filterData.mu.Lock() + filter.mu.Lock() for _, a := range cmd.Addresses { - wsc.filterData.addAddressStr(a) + filter.addAddressStr(a) } for _, op := range outPoints { - wsc.filterData.addUnspentOutPoint(op) + filter.addUnspentOutPoint(op) } - wsc.filterData.mu.Unlock() + filter.mu.Unlock() } return nil, nil