@@ -113,20 +113,20 @@ func (m *F3) Broadcast(ctx context.Context, signatureBuilder *gpbft.SignatureBui
113
113
}
114
114
115
115
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
118
118
}
119
119
return nil , ErrF3NotRunning
120
120
}
121
121
122
122
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 )
125
125
}
126
126
return nil , ErrF3NotRunning
127
127
}
128
128
129
- func (m * F3 ) GetCertStore (ctx context. Context ) (* certstore.Store , error ) {
129
+ func (m * F3 ) GetCertStore () (* certstore.Store , error ) {
130
130
if state := m .state .Load (); state != nil {
131
131
return state .cs , nil
132
132
}
@@ -135,8 +135,8 @@ func (m *F3) GetCertStore(ctx context.Context) (*certstore.Store, error) {
135
135
136
136
// GetPowerTableByInstance returns the power table (committee) used to validate the specified instance.
137
137
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 )
140
140
}
141
141
return nil , ErrF3NotRunning
142
142
}
0 commit comments