Skip to content

Commit c4c43a5

Browse files
committed
apply suggestions from AI
1 parent 98aa5c8 commit c4c43a5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

state/state.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,12 @@ func (i *Indexer) runConsensusFollower(ctx context.Context) {
643643
if err != nil {
644644
log.Fatalf("Failed to open consensus database at %s: %s", dbDir, err)
645645
}
646+
process.SetExitHandler(func() {
647+
log.Infof("Closing the consensus follower database")
648+
if err := db.Close(); err != nil {
649+
log.Errorf("Got error closing the consensus follower database: %s", err)
650+
}
651+
})
646652
protocolDB := pebbleimpl.ToDB(db)
647653
// Initialize a private key for joining the unstaked peer-to-peer network.
648654
// This can be ephemeral, so we generate a new one each time we start.
@@ -659,11 +665,11 @@ func (i *Indexer) runConsensusFollower(ctx context.Context) {
659665
for _, node := range spork.Consensus.SeedNodes {
660666
rawkey, err := hex.DecodeString(node.PublicKey)
661667
if err != nil {
662-
log.Fatalf("Failed to hex decode the seed node key %q: %s", key, err)
668+
log.Fatalf("Failed to hex decode the seed node key %q: %s", node.PublicKey, err)
663669
}
664670
pubkey, err := flowcrypto.DecodePublicKey(flowcrypto.ECDSAP256, rawkey)
665671
if err != nil {
666-
log.Fatalf("Failed to decode the seed node key %q: %s", key, err)
672+
log.Fatalf("Failed to decode the seed node key %q: %s", rawkey, err)
667673
}
668674
nodes = append(nodes, follower.BootstrapNodeInfo{
669675
Host: node.Host,

0 commit comments

Comments
 (0)