code: func newHeaderIndex(db walletdb.DB, indexType HeaderType) (*headerIndex, error) {
  	// As an initially step, we'll attempt to create all the buckets
  	// necessary for functioning of the index. If these buckets has already
  	// been created, then we can exit early.
  	err := walletdb.Update(db, func(tx walletdb.ReadWriteTx) error {
  		_, err := tx.CreateTopLevelBucket(indexBucket)
  		return err
  
  	})
  	if err != nil && err != walletdb.ErrBucketExists {
  		return nil, err
  	}
  
  	return &headerIndex{
  		db:        db,
  		indexType: indexType,
  	}, nil
  }
docs: // newHeaderIndex creates a new headerIndex given an already open database, and
  // a particular header type.