code: func (s *GlobalStore) lock(addr common.Address, key []byte) (unlock func(), err error) {
  	start := time.Now()
  	nodeLockKey := addr.Hex()
  	for {
  		_, loaded := s.nodesLocks.LoadOrStore(nodeLockKey, struct{}{})
  		if !loaded {
  			break
  		}
  		time.Sleep(lockCheckDelay)
  		if time.Since(start) > lockTimeout {
  			return nil, errLockTimeout
  		}
  	}
  	start = time.Now()
  	keyLockKey := common.Bytes2Hex(key)
  	for {
  		_, loaded := s.keysLocks.LoadOrStore(keyLockKey, struct{}{})
  		if !loaded {
  			break
  		}
  		time.Sleep(lockCheckDelay)
  		if time.Since(start) > lockTimeout {
  			return nil, errLockTimeout
  		}
  	}
  	return func() {
  		s.nodesLocks.Delete(nodeLockKey)
  		s.keysLocks.Delete(keyLockKey)
  	}, nil
  }
docs: // lock protects parallel writes in Put and Delete methods for both
  // node with provided address and for data with provided key.