Skip to content

Commit 9ab6bc0

Browse files
author
Qi Xiao
committed
Add missing error check in addBlock
1 parent 6ee542e commit 9ab6bc0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

sqlchain/observer/service.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ func (s *Service) addQueryTracker(dbID proto.DatabaseID, height int32, offset in
306306

307307
func (s *Service) addBlock(dbID proto.DatabaseID, count int32, b *types.Block) (err error) {
308308
instance, err := s.getUpstream(dbID)
309+
if err != nil {
310+
return
311+
}
312+
309313
h := int32(b.Timestamp().Sub(instance.GenesisBlock.Timestamp()) / conf.GConf.SQLChainPeriod)
310314
key := utils.ConcatAll(int32ToBytes(h), b.BlockHash().AsBytes(), int32ToBytes(count))
311315
// It's actually `countToBytes`

0 commit comments

Comments
 (0)