Skip to content

Commit 9afe720

Browse files
committed
GetCertStore codecov
1 parent 246fdf9 commit 9afe720

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

f3.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,20 @@ func (m *F3) Broadcast(ctx context.Context, signatureBuilder *gpbft.SignatureBui
113113
}
114114

115115
func (m *F3) GetLatestCert(context.Context) (*certs.FinalityCertificate, error) {
116-
if state := m.state.Load(); state != nil {
117-
return state.cs.Latest(), nil
116+
if cs, err := m.GetCertStore(); err != nil {
117+
return cs.Latest(), nil
118118
}
119119
return nil, ErrF3NotRunning
120120
}
121121

122122
func (m *F3) GetCert(ctx context.Context, instance uint64) (*certs.FinalityCertificate, error) {
123-
if state := m.state.Load(); state != nil {
124-
return state.cs.Get(ctx, instance)
123+
if cs, err := m.GetCertStore(); err != nil {
124+
return cs.Get(ctx, instance)
125125
}
126126
return nil, ErrF3NotRunning
127127
}
128128

129-
func (m *F3) GetCertStore(ctx context.Context) (*certstore.Store, error) {
129+
func (m *F3) GetCertStore() (*certstore.Store, error) {
130130
if state := m.state.Load(); state != nil {
131131
return state.cs, nil
132132
}
@@ -135,8 +135,8 @@ func (m *F3) GetCertStore(ctx context.Context) (*certstore.Store, error) {
135135

136136
// GetPowerTableByInstance returns the power table (committee) used to validate the specified instance.
137137
func (m *F3) GetPowerTableByInstance(ctx context.Context, instance uint64) (gpbft.PowerEntries, error) {
138-
if state := m.state.Load(); state != nil {
139-
return state.cs.GetPowerTable(ctx, instance)
138+
if cs, err := m.GetCertStore(); err != nil {
139+
return cs.GetPowerTable(ctx, instance)
140140
}
141141
return nil, ErrF3NotRunning
142142
}

0 commit comments

Comments
 (0)