OSDN Git Service

use__write_lock_for_take_over_instance (#2112)
authorPoseidon <shenao.78@163.com>
Sat, 18 Sep 2021 06:39:36 +0000 (14:39 +0800)
committerGitHub <noreply@github.com>
Sat, 18 Sep 2021 06:39:36 +0000 (14:39 +0800)
contract/trace_service.go

index 3104ea1..ff5d109 100644 (file)
@@ -178,8 +178,8 @@ func (t *TraceService) GetInstance(traceID string) (*Instance, error) {
 }
 
 func (t *TraceService) takeOverInstances(instances []*Instance, blockHash bc.Hash) bool {
-       t.RLock()
-       defer t.RUnlock()
+       t.Lock()
+       defer t.Unlock()
 
        if blockHash != t.bestHash {
                return false