mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +00:00
fix: lint error
This commit is contained in:
parent
218c05df9a
commit
d9a379d3fa
2 changed files with 16 additions and 16 deletions
|
|
@ -321,19 +321,19 @@ func (bn *BeaconNetwork) processContentLoop(ctx context.Context) {
|
||||||
|
|
||||||
func (bn *BeaconNetwork) generalSummariesValidation(contentKey, content []byte) (*ForkedHistoricalSummariesWithProof, error) {
|
func (bn *BeaconNetwork) generalSummariesValidation(contentKey, content []byte) (*ForkedHistoricalSummariesWithProof, error) {
|
||||||
key := &HistoricalSummariesWithProofKey{}
|
key := &HistoricalSummariesWithProofKey{}
|
||||||
err := key.Deserialize(codec.NewDecodingReader(bytes.NewReader(contentKey[1:]), uint64(len(contentKey[1:]))))
|
err := key.Deserialize(codec.NewDecodingReader(bytes.NewReader(contentKey[1:]), uint64(len(contentKey[1:]))))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
forkedHistoricalSummariesWithProof := &ForkedHistoricalSummariesWithProof{}
|
forkedHistoricalSummariesWithProof := &ForkedHistoricalSummariesWithProof{}
|
||||||
err = forkedHistoricalSummariesWithProof.Deserialize(bn.spec, codec.NewDecodingReader(bytes.NewReader(content), uint64(len(content))))
|
err = forkedHistoricalSummariesWithProof.Deserialize(bn.spec, codec.NewDecodingReader(bytes.NewReader(content), uint64(len(content))))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH != common.Epoch(key.Epoch) {
|
if forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH != common.Epoch(key.Epoch) {
|
||||||
return nil, fmt.Errorf("historical summaries with proof epoch does not match the content key epoch: %d != %d", forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH, key.Epoch)
|
return nil, fmt.Errorf("historical summaries with proof epoch does not match the content key epoch: %d != %d", forkedHistoricalSummariesWithProof.HistoricalSummariesWithProof.EPOCH, key.Epoch)
|
||||||
}
|
}
|
||||||
return forkedHistoricalSummariesWithProof, nil
|
return forkedHistoricalSummariesWithProof, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bn *BeaconNetwork) stateSummariesValidation(f ForkedHistoricalSummariesWithProof, latestFinalizedRoot common.Root) bool {
|
func (bn *BeaconNetwork) stateSummariesValidation(f ForkedHistoricalSummariesWithProof, latestFinalizedRoot common.Root) bool {
|
||||||
|
|
|
||||||
|
|
@ -165,18 +165,18 @@ func GetHistorySummariesWithProof() (HistoricalSummariesWithProof, common.Root,
|
||||||
}
|
}
|
||||||
data, err := snappy.Decode(nil, file)
|
data, err := snappy.Decode(nil, file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return HistoricalSummariesWithProof{}, common.Root{},err
|
return HistoricalSummariesWithProof{}, common.Root{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
beaconState := &deneb.BeaconState{}
|
beaconState := &deneb.BeaconState{}
|
||||||
err = beaconState.Deserialize(configs.Mainnet, codec.NewDecodingReader(bytes.NewReader(data), uint64(len(data))))
|
err = beaconState.Deserialize(configs.Mainnet, codec.NewDecodingReader(bytes.NewReader(data), uint64(len(data))))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return HistoricalSummariesWithProof{}, common.Root{},err
|
return HistoricalSummariesWithProof{}, common.Root{}, err
|
||||||
}
|
}
|
||||||
root := beaconState.HashTreeRoot(configs.Mainnet, tree.GetHashFn())
|
root := beaconState.HashTreeRoot(configs.Mainnet, tree.GetHashFn())
|
||||||
proof, err := BuildHistoricalSummariesProof(*beaconState)
|
proof, err := BuildHistoricalSummariesProof(*beaconState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return HistoricalSummariesWithProof{}, common.Root{},err
|
return HistoricalSummariesWithProof{}, common.Root{}, err
|
||||||
}
|
}
|
||||||
summariesProof := [5]common.Bytes32{tree.Root(proof[0]), tree.Root(proof[1]), tree.Root(proof[2]), tree.Root(proof[3]), tree.Root(proof[4])}
|
summariesProof := [5]common.Bytes32{tree.Root(proof[0]), tree.Root(proof[1]), tree.Root(proof[2]), tree.Root(proof[3]), tree.Root(proof[4])}
|
||||||
return HistoricalSummariesWithProof{
|
return HistoricalSummariesWithProof{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue