@@ -113,32 +113,35 @@ 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
+ cs , err := m .GetCertStore ()
117
+ if err != nil {
118
+ return nil , err
118
119
}
119
- return nil , ErrF3NotRunning
120
+ return cs . Latest (), nil
120
121
}
121
122
122
123
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 )
124
+ cs , err := m .GetCertStore ()
125
+ if err != nil {
126
+ return nil , err
125
127
}
126
- return nil , ErrF3NotRunning
128
+ return cs . Get ( ctx , instance )
127
129
}
128
130
129
- func (m * F3 ) GetCertStore (ctx context. Context ) (* certstore.Store , error ) {
130
- if state := m .state .Load (); state != nil {
131
+ func (m * F3 ) GetCertStore () (* certstore.Store , error ) {
132
+ if state := m .state .Load (); state != nil && state . cs != nil {
131
133
return state .cs , nil
132
134
}
133
135
return nil , ErrF3NotRunning
134
136
}
135
137
136
138
// GetPowerTableByInstance returns the power table (committee) used to validate the specified instance.
137
139
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 )
140
+ cs , err := m .GetCertStore ()
141
+ if err != nil {
142
+ return nil , err
140
143
}
141
- return nil , ErrF3NotRunning
144
+ return cs . GetPowerTable ( ctx , instance )
142
145
}
143
146
144
147
// computeBootstrapDelay returns the time at which the F3 instance specified by
0 commit comments