Skip to content

Commit 9ff81fa

Browse files
eth/catalyst: apply suggestions by holiman
1 parent 766097d commit 9ff81fa

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

core/beacon/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ func BlockToExecutableData(block *types.Block, fees *big.Int) *ExecutionPayloadE
230230
return &ExecutionPayloadEnvelope{ExecutionPayload: data, BlockValue: fees}
231231
}
232232

233+
// ExecutionPayloadBodyV1 is used in the response to GetPayloadBodiesByHashV1 and GetPayloadBodiesByRangeV1
233234
type ExecutionPayloadBodyV1 struct {
234235
TransactionData []hexutil.Bytes `json:"transactions"`
235236
Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"`

eth/catalyst/api.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,6 @@ func (api *ConsensusAPI) GetPayloadBodiesByHashV1(hashes []common.Hash) []*beaco
765765
var bodies = make([]*beacon.ExecutionPayloadBodyV1, len(hashes))
766766
for i, hash := range hashes {
767767
block := api.eth.BlockChain().GetBlockByHash(hash)
768-
if block == nil {
769-
continue
770-
}
771768
bodies[i] = getBody(block)
772769
}
773770
return bodies
@@ -783,15 +780,16 @@ func (api *ConsensusAPI) GetPayloadBodiesByRangeV1(start, count uint64) []*beaco
783780
bodies := make([]*beacon.ExecutionPayloadBodyV1, count)
784781
for i := uint64(0); i < count; i++ {
785782
block := api.eth.BlockChain().GetBlockByNumber(start + i)
786-
if block == nil {
787-
continue
788-
}
789783
bodies[i] = getBody(block)
790784
}
791785
return bodies
792786
}
793787

794788
func getBody(block *types.Block) *beacon.ExecutionPayloadBodyV1 {
789+
if block == nil {
790+
return nil
791+
}
792+
795793
var (
796794
body = block.Body()
797795
txs = make([]hexutil.Bytes, len(body.Transactions))

0 commit comments

Comments
 (0)