core: fix bloombits checking

This commit is contained in:
rjl493456442 2018-07-17 13:31:48 +08:00
parent b632f0be7a
commit a327f36447
2 changed files with 3 additions and 3 deletions

View file

@ -80,8 +80,8 @@ func (b *Generator) Bitset(idx uint) ([]byte, error) {
if b.nextBit != b.sections { if b.nextBit != b.sections {
return nil, errors.New("bloom not fully generated yet") return nil, errors.New("bloom not fully generated yet")
} }
if idx >= b.sections { if idx >= types.BloomBitLength {
return nil, errSectionOutOfBounds return nil, errors.New("bloom bit out of bounds")
} }
return b.blooms[idx], nil return b.blooms[idx], nil
} }

View file

@ -78,7 +78,7 @@ func testPutGet(db ethdb.Database, t *testing.T) {
_, err := db.Get([]byte("non-exist-key")) _, err := db.Get([]byte("non-exist-key"))
if err == nil { if err == nil {
t.Fatalf("expect to return a non found error") t.Fatalf("expect to return a not found error")
} }
for _, v := range test_values { for _, v := range test_values {