mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
adding in error for generic check (#14801)
This commit is contained in:
@@ -124,8 +124,12 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err
|
||||
Block: ð.GenericSignedBeaconBlock_BlindedDeneb{BlindedDeneb: pb.(*eth.SignedBlindedBeaconBlockDeneb)},
|
||||
}, nil
|
||||
}
|
||||
bc, ok := pb.(*eth.SignedBeaconBlockContentsDeneb)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("PbGenericBlock() only supports block content type but got %T", pb)
|
||||
}
|
||||
return ð.GenericSignedBeaconBlock{
|
||||
Block: ð.GenericSignedBeaconBlock_Deneb{Deneb: pb.(*eth.SignedBeaconBlockContentsDeneb)},
|
||||
Block: ð.GenericSignedBeaconBlock_Deneb{Deneb: bc},
|
||||
}, nil
|
||||
case version.Electra:
|
||||
if b.IsBlinded() {
|
||||
@@ -133,8 +137,12 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err
|
||||
Block: ð.GenericSignedBeaconBlock_BlindedElectra{BlindedElectra: pb.(*eth.SignedBlindedBeaconBlockElectra)},
|
||||
}, nil
|
||||
}
|
||||
bc, ok := pb.(*eth.SignedBeaconBlockContentsElectra)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("PbGenericBlock() only supports block content type but got %T", pb)
|
||||
}
|
||||
return ð.GenericSignedBeaconBlock{
|
||||
Block: ð.GenericSignedBeaconBlock_Electra{Electra: pb.(*eth.SignedBeaconBlockContentsElectra)},
|
||||
Block: ð.GenericSignedBeaconBlock_Electra{Electra: bc},
|
||||
}, nil
|
||||
case version.Fulu:
|
||||
if b.IsBlinded() {
|
||||
@@ -142,8 +150,12 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err
|
||||
Block: ð.GenericSignedBeaconBlock_BlindedFulu{BlindedFulu: pb.(*eth.SignedBlindedBeaconBlockFulu)},
|
||||
}, nil
|
||||
}
|
||||
bc, ok := pb.(*eth.SignedBeaconBlockContentsFulu)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("PbGenericBlock() only supports block content type but got %T", pb)
|
||||
}
|
||||
return ð.GenericSignedBeaconBlock{
|
||||
Block: ð.GenericSignedBeaconBlock_Fulu{Fulu: pb.(*eth.SignedBeaconBlockContentsFulu)},
|
||||
Block: ð.GenericSignedBeaconBlock_Fulu{Fulu: bc},
|
||||
}, nil
|
||||
default:
|
||||
return nil, errIncorrectBlockVersion
|
||||
|
||||
Reference in New Issue
Block a user