Skip to content

Commit e7a2503

Browse files
committed
remove nil check for the return value from CometBFT's VerifyLightBlockAtHeight since it never returns nil
Signed-off-by: Masanori Yoshida <masanori.yoshida@datachain.jp>
1 parent 687400c commit e7a2503

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

chains/tendermint/prover.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,16 @@ func (pr *Prover) UpdateLightClient(height int64) (core.Header, error) {
195195

196196
var sh *types.LightBlock
197197
if height == 0 {
198-
sh, err = client.Update(context.Background(), time.Now())
198+
if sh, err = client.Update(context.Background(), time.Now()); err != nil {
199+
return nil, lightError(err)
200+
} else if sh == nil {
201+
sh, err = client.TrustedLightBlock(0)
202+
if err != nil {
203+
return nil, lightError(err)
204+
}
205+
}
199206
} else {
200-
sh, err = client.VerifyLightBlockAtHeight(context.Background(), height, time.Now())
201-
}
202-
if err != nil {
203-
return nil, lightError(err)
204-
}
205-
206-
if sh == nil {
207-
sh, err = client.TrustedLightBlock(height)
208-
if err != nil {
207+
if sh, err = client.VerifyLightBlockAtHeight(context.Background(), height, time.Now()); err != nil {
209208
return nil, lightError(err)
210209
}
211210
}

0 commit comments

Comments
 (0)