Ignore block validation for genesis block

This commit is contained in:
ChronosX88 2021-07-20 01:39:14 +03:00
parent ed9fa658ed
commit cbce24fdce
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -133,12 +133,14 @@ func (bc *BlockChain) StoreBlock(block *types2.Block) error {
return nil return nil
} }
err := bc.ValidateBlock(block) if block.Header.Height != 0 {
if err != nil { err := bc.ValidateBlock(block)
return fmt.Errorf("failed to store block: %w", err) if err != nil {
return fmt.Errorf("failed to store block: %w", err)
}
} }
err = bc.dbEnv.Update(func(txn *lmdb.Txn) error { err := bc.dbEnv.Update(func(txn *lmdb.Txn) error {
data, err := cbor.Marshal(block.Data) data, err := cbor.Marshal(block.Data)
if err != nil { if err != nil {
return err return err