Improve get raw block not found handling

This commit is contained in:
Martin Boehm 2022-03-07 20:50:35 +01:00
parent fad284a425
commit 673cdbc446

View File

@ -1715,6 +1715,12 @@ func (w *Worker) GetBlockRaw(bid string) (*BlockRaw, error) {
return nil, NewAPIError("Block not found", true)
}
hex, err := w.chain.GetBlockRaw(hash)
if err != nil {
if err == bchain.ErrBlockNotFound {
return nil, NewAPIError("Block not found", true)
}
return nil, err
}
return &BlockRaw{Hex: hex}, err
}