Skip to content

Commit 86e95aa

Browse files
committed
multi: fix linter issues, go.mod re-init
1 parent 2eeac3a commit 86e95aa

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ require (
3939
golang.org/x/net v0.17.0
4040
golang.org/x/sync v0.2.0
4141
golang.org/x/term v0.13.0
42+
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
4243
google.golang.org/grpc v1.56.3
4344
google.golang.org/protobuf v1.30.0
4445
gopkg.in/macaroon-bakery.v2 v2.1.0
@@ -187,7 +188,6 @@ require (
187188
golang.org/x/mod v0.10.0 // indirect
188189
golang.org/x/sys v0.13.0 // indirect
189190
golang.org/x/text v0.13.0 // indirect
190-
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
191191
golang.org/x/tools v0.9.1 // indirect
192192
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
193193
gopkg.in/errgo.v1 v1.0.1 // indirect

tapdb/multiverse.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (p *proofCache) insertProof(id universe.Identifier,
170170
id.StringForLog(), leafKey, proofKey[:])
171171

172172
proofVal := cachedProof(proof)
173-
assetProofCache.Put(proofKey, &proofVal)
173+
_, _ = assetProofCache.Put(proofKey, &proofVal)
174174
}
175175

176176
// delProofsForAsset deletes all the proofs for the given asset.
@@ -215,15 +215,15 @@ type rootPageCache = lru.Cache[rootPageQuery, universeRootPage]
215215
type atomicRootCache = atomic.Pointer[rootPageCache]
216216

217217
// newAtomicRootCache creates a new atomic root cache.
218-
func newAtomicRootCache() atomicRootCache {
218+
func newAtomicRootCache() *atomicRootCache {
219219
rootCache := lru.NewCache[rootPageQuery, universeRootPage](
220220
numCachedProofs,
221221
)
222222

223223
var a atomicRootCache
224224
a.Store(rootCache)
225225

226-
return a
226+
return &a
227227
}
228228

229229
// rootIndex maps a tree ID to a universe root.
@@ -233,21 +233,21 @@ type rootIndex = lnutils.SyncMap[treeID, *universe.Root]
233233
type atomicRootIndex = atomic.Pointer[rootIndex]
234234

235235
// newAtomicRootIndex creates a new atomic root index.
236-
func newAtomicRootIndex() atomicRootIndex {
236+
func newAtomicRootIndex() *atomicRootIndex {
237237
var a atomicRootIndex
238238
a.Store(&rootIndex{})
239239

240-
return a
240+
return &a
241241
}
242242

243243
// rootNodeCache is used to cache the set of active root nodes for the
244244
// multiverse tree.
245245
type rootNodeCache struct {
246246
sync.RWMutex
247247

248-
rootIndex atomicRootIndex
248+
rootIndex *atomicRootIndex
249249

250-
allRoots atomicRootCache
250+
allRoots *atomicRootCache
251251

252252
*cacheLogger
253253

@@ -321,10 +321,12 @@ func (r *rootNodeCache) cacheRoots(q universe.RootNodesQuery,
321321

322322
// Store the main root pointer, then update the root index.
323323
rootPageCache := r.allRoots.Load()
324-
rootPageCache.Put(newRootPageQuery(q), rootNodes)
324+
_, _ = rootPageCache.Put(newRootPageQuery(q), rootNodes)
325325

326326
rootIndex := r.rootIndex.Load()
327327
for _, rootNode := range rootNodes {
328+
rootNode := rootNode
329+
328330
idStr := treeID(rootNode.ID.String())
329331
rootIndex.Store(idStr, &rootNode)
330332
}
@@ -451,11 +453,11 @@ func (u *universeLeafCache) cacheLeafKeys(q universe.UniverseLeafKeysQuery,
451453
}
452454

453455
// Store the cache in the top level cache.
454-
u.leafCache.Put(idStr, pageCache)
456+
_, _ = u.leafCache.Put(idStr, pageCache)
455457
}
456458

457459
// Add the to the page cache.
458-
pageCache.Put(newLeafQuery(q), &cachedKeys)
460+
_, _ = pageCache.Put(newLeafQuery(q), &cachedKeys)
459461
}
460462

461463
// wipeCache wipes the cache of leaf keys for a given universe ID.

tapdb/universe_federation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ type UniverseFederationDB struct {
142142

143143
clock clock.Clock
144144

145-
globalCfg atomic.Pointer[globalSyncCfgs]
146-
assetCfgs atomic.Pointer[assetSyncCfgs]
145+
globalCfg *atomic.Pointer[globalSyncCfgs]
146+
assetCfgs *atomic.Pointer[assetSyncCfgs]
147147
}
148148

149149
// NewUniverseFederationDB makes a new Universe federation DB.
@@ -161,8 +161,8 @@ func NewUniverseFederationDB(db BatchedUniverseServerStore,
161161
return &UniverseFederationDB{
162162
db: db,
163163
clock: clock,
164-
globalCfg: globalCfgPtr,
165-
assetCfgs: assetCfgsPtr,
164+
globalCfg: &globalCfgPtr,
165+
assetCfgs: &assetCfgsPtr,
166166
}
167167
}
168168

tapdb/universe_stats.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ type atomicSyncStatsCache struct {
181181
*cacheLogger
182182
}
183183

184-
func newAtomicSyncStatsCache() atomicSyncStatsCache {
185-
return atomicSyncStatsCache{
184+
func newAtomicSyncStatsCache() *atomicSyncStatsCache {
185+
return &atomicSyncStatsCache{
186186
cacheLogger: newCacheLogger("sync stats"),
187187
}
188188
}
@@ -288,7 +288,7 @@ type UniverseStats struct {
288288
eventsCacheLogger *cacheLogger
289289

290290
syncStatsMtx sync.Mutex
291-
syncStatsCache atomicSyncStatsCache
291+
syncStatsCache *atomicSyncStatsCache
292292
syncStatsRefresh *time.Timer
293293
}
294294

@@ -710,7 +710,7 @@ func (u *UniverseStats) QueryAssetStatsPerDay(ctx context.Context,
710710
}
711711

712712
// We have a fresh result, so we'll cache it now.
713-
u.assetEventsCache.Put(query, results)
713+
_, _ = u.assetEventsCache.Put(query, results)
714714

715715
return results, nil
716716
}

universe/base.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ func (a *Archive) UpsertProofLeaf(ctx context.Context, id Identifier,
178178
if err := existingProof.Decode(bytes.NewReader(
179179
issuanceProof.Leaf.RawProof,
180180
)); err != nil {
181-
182181
return nil, err
183182
}
184183

universe/syncer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ func (s *SimpleSyncer) syncRoot(ctx context.Context, remoteRoot Root,
343343
if !isIssuanceTree {
344344
transferLeaves := fn.Collect(transferLeafProofs)
345345
sort.Slice(transferLeaves, func(i, j int) bool {
346-
347346
// We'll need to decode the block heights from the
348347
// proof, so we'll make a record to do so.
349348
var iBlockHeight, jBlockHeight uint32

0 commit comments

Comments
 (0)