forked from cerc-io/ipld-eth-server
(VDB-68) Verify log block hash matches header block hash
- Delete header on conflict to prompt data refresh (cascade deletes all data associated with that block) - Derive header hash from rpc payload rather than computing it from data (prevents hash mismatch between blockchain and cache)
This commit is contained in:
@@ -39,7 +39,13 @@ func (repository CatFileChopLumpRepository) Create(headerID int64, models []inte
|
||||
return fmt.Errorf("model of type %T, not %T", model, CatFileChopLumpModel{})
|
||||
}
|
||||
|
||||
_, err := tx.Exec(
|
||||
err = shared.ValidateHeaderConsistency(headerID, chopLump.Raw, repository.db)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = tx.Exec(
|
||||
`INSERT into maker.cat_file_chop_lump (header_id, ilk, what, data, tx_idx, log_idx, raw_log)
|
||||
VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7)`,
|
||||
headerID, chopLump.Ilk, chopLump.What, chopLump.Data, chopLump.TransactionIndex, chopLump.LogIndex, chopLump.Raw,
|
||||
|
||||
Reference in New Issue
Block a user