Return error when loading not existing block in ETH #176

indexv5
Martin Boehm 2019-05-23 16:05:33 +02:00
parent 5ef22e86dc
commit 4f9feb4d4f
1 changed files with 3 additions and 0 deletions

View File

@ -967,6 +967,9 @@ func (w *Worker) GetBlock(bid string, page int, txsOnPage int) (*Block, error) {
} else {
hash = bid
}
if hash == "" {
return nil, NewAPIError("Block not found", true)
}
bi, err := w.chain.GetBlockInfo(hash)
if err != nil {
if err == bchain.ErrBlockNotFound {