-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db-sync: Improve error detection/handling during ledger state updates
There is a bug in the way the 6.0.0 release handles ledger state updates which can result in the ledger state getting corrupted. This commit: * Correctly checks the previous block hash against the ledger head hash to make sure they are correct. * If the hash check fails, the code panics, which is then retried at a higher level which should allow db-sync to continue on as if nothing had happened. This is not the final fix, just a workaround.
- Loading branch information
Showing
3 changed files
with
77 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module Cardano.DbSync.Era.Cardano.Util | ||
( unChainHash | ||
) where | ||
|
||
import qualified Data.ByteString.Short as BSS | ||
|
||
import Cardano.DbSync.Config.Types | ||
|
||
import Cardano.Prelude | ||
|
||
import qualified Ouroboros.Consensus.HardFork.Combinator as Consensus | ||
|
||
import Ouroboros.Network.Block (ChainHash (..)) | ||
|
||
|
||
unChainHash :: ChainHash CardanoBlock -> ByteString | ||
unChainHash ch = | ||
case ch of | ||
GenesisHash -> "genesis" | ||
BlockHash bh -> BSS.fromShort (Consensus.getOneEraHash bh) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters