Correctly return electra attestations for block getter (#13993)

This commit is contained in:
terence
2024-05-13 20:33:01 -07:00
committed by GitHub
parent 0de1282e1c
commit 6e81b4e84b
2 changed files with 14 additions and 1 deletions

View File

@@ -1116,7 +1116,7 @@ func (b *BeaconBlockBody) Attestations() []interfaces.Attestation {
return nil
}
atts = make([]interfaces.Attestation, len(b.attestationsElectra))
for i, a := range b.attestations {
for i, a := range b.attestationsElectra {
atts[i] = a
}
}

View File

@@ -369,6 +369,19 @@ func Test_BeaconBlockBody_Attestations(t *testing.T) {
assert.DeepSSZEqual(t, a, bb.Block().Body().Attestations())
}
func Test_BeaconBlockBody_ElectraAttestations(t *testing.T) {
bb := &SignedBeaconBlock{
block: &BeaconBlock{body: &BeaconBlockBody{
version: version.Electra,
attestationsElectra: []*eth.AttestationElectra{{
Signature: []byte("electra"),
}},
}}}
a := bb.Block().Body().Attestations()
require.Equal(t, 1, len(a))
require.DeepEqual(t, a[0].GetSignature(), []byte("electra"))
}
func Test_BeaconBlockBody_Deposits(t *testing.T) {
d := make([]*eth.Deposit, 0)
bb := &SignedBeaconBlock{block: &BeaconBlock{body: &BeaconBlockBody{}}}