Use local type as ctx key
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
1cd584d81b
commit
6dafca7aac
@ -752,10 +752,10 @@ func (syncer *Syncer) verifyBlsAggregate(ctx context.Context, sig types.Signatur
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const syncStateKey = "syncStateKey"
|
type syncStateKey struct{}
|
||||||
|
|
||||||
func extractSyncState(ctx context.Context) *SyncerState {
|
func extractSyncState(ctx context.Context) *SyncerState {
|
||||||
v := ctx.Value(syncStateKey)
|
v := ctx.Value(syncStateKey{})
|
||||||
if v != nil {
|
if v != nil {
|
||||||
return v.(*SyncerState)
|
return v.(*SyncerState)
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ func (sm *SyncManager) syncWorker(id int) {
|
|||||||
}
|
}
|
||||||
log.Info("sync worker go time!", ts.Height(), ts.Cids())
|
log.Info("sync worker go time!", ts.Height(), ts.Cids())
|
||||||
|
|
||||||
ctx := context.WithValue(context.TODO(), syncStateKey, ss)
|
ctx := context.WithValue(context.TODO(), syncStateKey{}, ss)
|
||||||
err := sm.doSync(ctx, ts)
|
err := sm.doSync(ctx, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("sync error: %+v", err)
|
log.Errorf("sync error: %+v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user