diff --git a/cmd/geth/retesteth.go b/cmd/geth/retesteth.go index 0615f446fc..8453f753fb 100644 --- a/cmd/geth/retesteth.go +++ b/cmd/geth/retesteth.go @@ -533,6 +533,9 @@ func (api *RetestethAPI) mineBlock() error { } } block, err := api.engine.FinalizeAndAssemble(api.blockchain, header, statedb, txs, []*types.Header{}, receipts) + if err != nil { + return err + } return api.importBlock(block) } diff --git a/core/rawdb/freezer_table.go b/core/rawdb/freezer_table.go index 2fe354a064..61804f1f2b 100644 --- a/core/rawdb/freezer_table.go +++ b/core/rawdb/freezer_table.go @@ -272,7 +272,9 @@ func (t *freezerTable) repair() error { if newLastIndex.filenum != lastIndex.filenum { // Release earlier opened file t.releaseFile(lastIndex.filenum) - t.head, err = t.openFile(newLastIndex.filenum, openFreezerFileForAppend) + if t.head, err = t.openFile(newLastIndex.filenum, openFreezerFileForAppend); err != nil { + return err + } if stat, err = t.head.Stat(); err != nil { // TODO, anything more we can do here? // A data file has gone missing... diff --git a/core/rawdb/freezer_table_test.go b/core/rawdb/freezer_table_test.go index 253c00f5a5..4d43753806 100644 --- a/core/rawdb/freezer_table_test.go +++ b/core/rawdb/freezer_table_test.go @@ -113,6 +113,9 @@ func TestFreezerBasicsClosing(t *testing.T) { f.Append(uint64(x), data) f.Close() f, err = newCustomTable(os.TempDir(), fname, rm, wm, sc, 50, true) + if err != nil { + t.Fatal(err) + } } defer f.Close() @@ -170,6 +173,9 @@ func TestFreezerRepairDanglingHead(t *testing.T) { // Now open it again { f, err := newCustomTable(os.TempDir(), fname, rm, wm, sc, 50, true) + if err != nil { + t.Fatal(err) + } // The last item should be missing if _, err = f.Retrieve(0xff); err == nil { t.Errorf("Expected error for missing index entry") @@ -217,6 +223,9 @@ func TestFreezerRepairDanglingHeadLarge(t *testing.T) { // Now open it again { f, err := newCustomTable(os.TempDir(), fname, rm, wm, sc, 50, true) + if err != nil { + t.Fatal(err) + } // The first item should be there if _, err = f.Retrieve(0); err != nil { t.Fatal(err) @@ -269,6 +278,9 @@ func TestSnappyDetection(t *testing.T) { // Open without snappy { f, err := newCustomTable(os.TempDir(), fname, rm, wm, sc, 50, false) + if err != nil { + t.Fatal(err) + } if _, err = f.Retrieve(0); err == nil { f.Close() t.Fatalf("expected empty table") @@ -278,6 +290,9 @@ func TestSnappyDetection(t *testing.T) { // Open with snappy { f, err := newCustomTable(os.TempDir(), fname, rm, wm, sc, 50, true) + if err != nil { + t.Fatal(err) + } // There should be 255 items if _, err = f.Retrieve(0xfe); err != nil { f.Close()