Use sszRoot instead of sszObj for MhKey

This commit is contained in:
Abdul Rabbani 2022-05-13 10:20:23 -04:00
parent e5fa95d851
commit 74d80e648a
2 changed files with 12 additions and 10 deletions

View File

@ -56,7 +56,7 @@ var _ = Describe("Capturehead", func() {
dbPassword string = "password"
dbDriver string = "pgx"
dummyParentRoot string = "46f98c08b54a71dfda4d56e29ec3952b8300cd8d6b67a9b6c562ae96a7a25a42"
knownGapsTableIncrement int = 10000
knownGapsTableIncrement int = 100000
maxRetry int = 30
)

View File

@ -95,7 +95,7 @@ func (dw *DatabaseWriter) prepareSlotsModel(slot int, stateRoot string, blockRoo
// Create the model for the ethcl.signed_beacon_block table.
func (dw *DatabaseWriter) prepareSignedBeaconBlockModel(slot int, blockRoot string, parentBlockRoot string, eth1BlockHash string) error {
mhKey, err := MultihashKeyFromSSZRoot(dw.rawSignedBeaconBlock)
mhKey, err := MultihashKeyFromSSZRoot([]byte(dw.DbSlots.BlockRoot))
if err != nil {
return err
}
@ -112,7 +112,7 @@ func (dw *DatabaseWriter) prepareSignedBeaconBlockModel(slot int, blockRoot stri
// Create the model for the ethcl.beacon_state table.
func (dw *DatabaseWriter) prepareBeaconStateModel(slot int, stateRoot string) error {
mhKey, err := MultihashKeyFromSSZRoot(dw.rawSignedBeaconBlock)
mhKey, err := MultihashKeyFromSSZRoot([]byte(dw.DbSlots.StateRoot))
if err != nil {
return err
}
@ -133,13 +133,15 @@ func (dw *DatabaseWriter) writeFullSlot() error {
if err != nil {
return err
}
err = dw.writeSignedBeaconBlocks()
if err != nil {
return err
}
err = dw.writeBeaconState()
if err != nil {
return err
if dw.DbSlots.Status != "skipped" {
err = dw.writeSignedBeaconBlocks()
if err != nil {
return err
}
err = dw.writeBeaconState()
if err != nil {
return err
}
}
dw.Metrics.IncrementHeadTrackingInserts(1)
return nil