Skip to content

Commit

Permalink
les: return error for missing header also in les backend - StateAndHe…
Browse files Browse the repository at this point in the history
…aderByNumber
  • Loading branch information
holiman committed Mar 5, 2019
1 parent 6434c5a commit 4ef987e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion les/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ func (b *LesApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumb

func (b *LesApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
header, err := b.HeaderByNumber(ctx, blockNr)
if header == nil || err != nil {
if err != nil {
return nil, nil, err
}
if header == nil {
return nil, nil, errors.New("header not found")
}
return light.NewState(ctx, header, b.eth.odr), header, nil
}

Expand Down

0 comments on commit 4ef987e

Please sign in to comment.